From: Borislav Petkov (AMD) Date: Fri, 12 Sep 2025 22:29:15 +0000 (-0400) Subject: KVM: SVM: Set synthesized TSA CPUID flags X-Git-Tag: v6.1.153~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8f64204eadc7ebb42ff75568574be465f97aa3;p=thirdparty%2Fkernel%2Fstable.git KVM: SVM: Set synthesized TSA CPUID flags Commit f3f9deccfc68a6b7c8c1cc51e902edba23d309d4 in the LTS tree. VERW_CLEAR is supposed to be set only by the hypervisor to denote TSA mitigation support to a guest. SQ_NO and L1_NO are both synthesizable, and are going to be set by hw CPUID on future machines. So keep the kvm_cpu_cap_init_kvm_defined() invocation *and* set them when synthesized. This fix is stable-only. Co-developed-by: Jinpu Wang Signed-off-by: Jinpu Wang Signed-off-by: Borislav Petkov (AMD) Signed-off-by: Greg Kroah-Hartman Cc: # 6.1.y Signed-off-by: Boris Ostrovsky Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index e53ccf8a090d3..db508118891d0 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -770,10 +770,15 @@ void kvm_set_cpu_caps(void) if (cpu_feature_enabled(X86_FEATURE_SRSO_NO)) kvm_cpu_cap_set(X86_FEATURE_SRSO_NO); + kvm_cpu_cap_check_and_set(X86_FEATURE_VERW_CLEAR); + kvm_cpu_cap_init_kvm_defined(CPUID_8000_0021_ECX, F(TSA_SQ_NO) | F(TSA_L1_NO) ); + kvm_cpu_cap_check_and_set(X86_FEATURE_TSA_SQ_NO); + kvm_cpu_cap_check_and_set(X86_FEATURE_TSA_L1_NO); + /* * Hide RDTSCP and RDPID if either feature is reported as supported but * probing MSR_TSC_AUX failed. This is purely a sanity check and