KVM: SVM: Set synthesized TSA CPUID flags

commit f3f9deccfc68a6b7c8c1cc51e902edba23d309d4 upstream.

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 <jinpu.wang@ionos.com>
Signed-off-by: Jinpu Wang <jinpu.wang@ionos.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Borislav Petkov (AMD)
2025-07-15 21:24:59 +02:00
committed by Greg Kroah-Hartman
parent 2b8a1969ca
commit 2089d8a316

View File

@@ -791,10 +791,15 @@ void kvm_set_cpu_caps(void)
F(PERFMON_V2)
);
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);
/*
* Synthesize "LFENCE is serializing" into the AMD-defined entry in
* KVM's supported CPUID if the feature is reported as supported by the