Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4723050ybp; Mon, 7 Oct 2019 12:55:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRXcnXKR+9B8tIN1KBfyBQ74Jiddn3dbyVSuHKCbBvaqZ2KtUIndjV/qM6CT4QFgYSMwBe X-Received: by 2002:a50:ef12:: with SMTP id m18mr30537768eds.18.1570478103820; Mon, 07 Oct 2019 12:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570478103; cv=none; d=google.com; s=arc-20160816; b=K3AFTdz2X9e6nQTgPzYNDhYanuuCSuNu6yY61zDXvJwLuwhz3YpTWXlzPD7hS4v8Ci naAznDIVQhT65dMap7S7qH/Ye6GErNZLdy8rQeyk9PIOVhxEhOQjeJN1MpWuRrcGdsjG 4/mIkNoYrKfCMa7sv/sjN1tadpWzbJtnb13++GDjlraio7taQMyqAVKaGJTDaYA+/Fo7 seJQUgm0Hh3Zer2D3M06CZWAyjikSWlAeUSKkh9Lq4SJxXGmalix+ZusYcXl1GNuS53/ AzkKmPj/jXJBK3npxYpTsUwDOjmdlJpMdG9nA0pI56pvFavTcM9asHIlEdW0YPSd8D6M X36g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Ms0O1FiR8QVJtL8Kw8rEZxnsllac4dmo33A1PolUKeE=; b=CrZUo8qYkCbfKHv7YK9pphDem8jUj3rePoZql0OUse60QIkCxnkk8gNBr1hfwEHPfj eNF+aNiCEHcgvzVFzIttSHaOnsLCC+35xbZuQ9dV0DV1zhHbuOYQrqJe7z2gjIMSJvpj 97fbKTSk1OEVO61/+eiyuZOcOm8bUChxuBy3+GEXxlpF2JmwUMRi7JupE90dDFWvN5Wd X9+mi+i3zdvMAVS/mH03tzVbRDWCa62VYHdBqOYirEI6ewR6VddAWMl9nFg78Ej3ibvX BytnGeGJWZa94GGOdLbyA4DQ6yjhz+phxmODYA+gddg7wibtNhRFx6G4J9aHtigRH5Wo GrPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si8230756ejm.122.2019.10.07.12.54.40; Mon, 07 Oct 2019 12:55:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729048AbfJGTyY (ORCPT + 99 others); Mon, 7 Oct 2019 15:54:24 -0400 Received: from mga14.intel.com ([192.55.52.115]:57605 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728187AbfJGTyY (ORCPT ); Mon, 7 Oct 2019 15:54:24 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 12:54:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="scan'208";a="199612480" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by FMSMGA003.fm.intel.com with ESMTP; 07 Oct 2019 12:54:22 -0700 Date: Mon, 7 Oct 2019 12:54:22 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Peter Zijlstra , Arnaldo Carvalho de Melo , Radim =?utf-8?B?S3LEjW3DocWZ?= , Tony Luck , Tony W Wang-oc , "H. Peter Anvin" , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-edac@vger.kernel.org, Borislav Petkov , Jarkko Sakkinen Subject: Re: [PATCH 10/16] x86/cpu: Detect VMX features on Intel, Centaur and Zhaoxin CPUs Message-ID: <20191007195422.GF18016@linux.intel.com> References: <20191004215615.5479-1-sean.j.christopherson@intel.com> <20191004215615.5479-11-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 07:11:24PM +0200, Paolo Bonzini wrote: > On 04/10/19 23:56, Sean Christopherson wrote: > > + /* > > + * The high bits contain the allowed-1 settings, i.e. features that can > > + * be turned on. The low bits contain the allowed-0 settings, i.e. > > + * features that can be turned off. Ignore the allowed-0 settings, > > + * if a feature can be turned on then it's supported. > > + */ > > + rdmsr(MSR_IA32_VMX_PINBASED_CTLS, ign, supported); > > For QEMU, we're defining a feature as supported if a feature can be > turned both on and off. Since msr_low and msr_high can be defined > respectively as must-be-one and can-be-one, the features become > "msr_high & ~msr_low". That makes sense for Qemu, but I don't think it's appropriate for this type of reporting. E.g. if EPT and Unrestricted Guest are must-be-one on a hypothetical (virtual) CPU, it'd be odd to not list them as a supported feature. For actual hardware (well, Intel hardware), as proposed it's a moot point. The only features that are must-be-one (even without "true" MSRs) and are documented in the SDM are CR3_LOAD_EXITING, CR3_STORE_EXITING, SAVE_DEBUG_CONTROLS, and LOAD_DEBUG_CONTROLS, none of which are reported in /proc/cpuinfo. > Also, shouldn't this use the "true" feature availability MSRs if available? Only if incorporating the "& ~msr_low" can-be-one logic. If a feature is considered supported if it must-be-one or can-be-one then the true MSR and vanilla MSR will yield the same feature set. > > Paolo