public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	 Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org,  "H. Peter Anvin" <hpa@zytor.com>,
	Shuah Khan <shuah@kernel.org>,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	 Clayton Pence <ctpence@google.com>
Subject: Re: [PATCH 1/3] KVM: x86: Rename supports_cpuid_fault to supports_intel_cpuid_fault
Date: Fri, 10 Apr 2026 15:21:04 -0700	[thread overview]
Message-ID: <adl30JQXxxQGmHvj@google.com> (raw)
In-Reply-To: <20260402223108.650572-2-jmattson@google.com>

On Thu, Apr 02, 2026, Jim Mattson wrote:
> The function, supports_cpuid_fault(), tests for guest support of Intel's
> CPUID faulting feature. Rename the function to supports_intel_cpuid_fault()
> for clarity.
> 
> Signed-off-by: Jim Mattson <jmattson@google.com>
> ---
>  arch/x86/kvm/cpuid.h | 2 +-
>  arch/x86/kvm/x86.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
> index 039b8e6f40ba..51cbe67c992a 100644
> --- a/arch/x86/kvm/cpuid.h
> +++ b/arch/x86/kvm/cpuid.h
> @@ -181,7 +181,7 @@ static inline int guest_cpuid_stepping(struct kvm_vcpu *vcpu)
>  	return x86_stepping(best->eax);
>  }
>  
> -static inline bool supports_cpuid_fault(struct kvm_vcpu *vcpu)
> +static inline bool supports_intel_cpuid_fault(struct kvm_vcpu *vcpu)

*sigh*

I was going to suggest supports_misc_enables_cpuid_fault(), since KVM emulates
the MSR for all CPU vendors, but the enable is in MISC_FEATURE_ENABLES, not
IA32_MISC_ENABLES.

What if we just drop the helper?  There's only one user.  I.e.

diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 039b8e6f40ba..8b64d863e19c 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -181,11 +181,6 @@ static inline int guest_cpuid_stepping(struct kvm_vcpu *vcpu)
        return x86_stepping(best->eax);
 }
 
-static inline bool supports_cpuid_fault(struct kvm_vcpu *vcpu)
-{
-       return vcpu->arch.msr_platform_info & MSR_PLATFORM_INFO_CPUID_FAULT;
-}
-
 static inline bool cpuid_fault_enabled(struct kvm_vcpu *vcpu)
 {
        return vcpu->arch.msr_misc_features_enables &
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2410401c57d8..c72ea99422ca 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4262,7 +4262,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_MISC_FEATURES_ENABLES:
                if (data & ~MSR_MISC_FEATURES_ENABLES_CPUID_FAULT ||
                    (data & MSR_MISC_FEATURES_ENABLES_CPUID_FAULT &&
-                    !supports_cpuid_fault(vcpu)))
+                    !(vcpu->arch.msr_platform_info & MSR_PLATFORM_INFO_CPUID_FAULT)))
                        return 1;
                vcpu->arch.msr_misc_features_enables = data;
                break;

  reply	other threads:[~2026-04-10 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 22:30 [PATCH 0/3] KVM: x86: Virtualize AMD CPUID faulting Jim Mattson
2026-04-02 22:31 ` [PATCH 1/3] KVM: x86: Rename supports_cpuid_fault to supports_intel_cpuid_fault Jim Mattson
2026-04-10 22:21   ` Sean Christopherson [this message]
2026-04-10 22:22     ` Jim Mattson
2026-04-02 22:31 ` [PATCH 2/3] KVM: x86: Virtualize AMD CPUID faulting Jim Mattson
2026-04-02 22:31 ` [PATCH 3/3] KVM: selftests: Update hwcr_msr_test for CPUID faulting bit Jim Mattson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adl30JQXxxQGmHvj@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=ctpence@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox