[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4133bdb5-be2c-4594-aba2-511cecb5a343@zytor.com>
Date: Fri, 1 Aug 2025 09:11:33 -0700
From: Xin Li <xin@...or.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org, pbonzini@...hat.com,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
chao.gao@...el.com
Subject: Re: [PATCH v1 4/4] KVM: x86: Advertise support for the immediate form
of MSR instructions
On 8/1/2025 7:39 AM, Sean Christopherson wrote:
> On Wed, Jul 30, 2025, Xin Li (Intel) wrote:
>> Advertise support for the immediate form of MSR instructions to userspace
>> if the instructions are supported by the underlying CPU.
>
> SVM needs to explicitly clear the capability so that KVM doesn't over-advertise
> support if AMD ever implements X86_FEATURE_MSR_IMM.
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index ca550c4fa174..7e7821ee8ee1 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -5311,8 +5311,12 @@ static __init void svm_set_cpu_caps(void)
> /* CPUID 0x8000001F (SME/SEV features) */
> sev_set_cpu_caps();
>
> - /* Don't advertise Bus Lock Detect to guest if SVM support is absent */
> + /*
> + * Clear capabilities that are automatically configured by common code,
> + * but that require explicit SVM support (that isn't yet implemented).
> + */
> kvm_cpu_cap_clear(X86_FEATURE_BUS_LOCK_DETECT);
> + kvm_cpu_cap_clear(X86_FEATURE_MSR_IMM);
> }
>
> static __init int svm_hardware_setup(void)
>
Nice catch!
Yes, a feature needing explicit enabling effort can't be blindly
advertised until the support on all sub-arch is ready. I.e., I need to
disable it on non-Intel CPUs because it's only done for Intel.
Powered by blists - more mailing lists