Skip to content

Commit 8715f05

Browse files
jsmattsonjrbonzini
authored andcommitted
kvm: x86: Host feature SSBD doesn't imply guest feature AMD_SSBD
The host reports support for the synthetic feature X86_FEATURE_SSBD when any of the three following hardware features are set: CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] CPUID.80000008H:EBX.AMD_SSBD[bit 24] CPUID.80000008H:EBX.VIRT_SSBD[bit 25] Either of the first two hardware features implies the existence of the IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does not. Therefore, CPUID.80000008H:EBX.AMD_SSBD[bit 24] should only be set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host. Fixes: 4c6903a ("KVM: x86: fix reporting of AMD speculation bug CPUID leaf") Signed-off-by: Jim Mattson <[email protected]> Reviewed-by: Jacob Xu <[email protected]> Reviewed-by: Peter Shier <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: [email protected] Reported-by: Eric Biggers <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 396d2e8 commit 8715f05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function,
760760
entry->ebx |= F(AMD_IBRS);
761761
if (boot_cpu_has(X86_FEATURE_STIBP))
762762
entry->ebx |= F(AMD_STIBP);
763-
if (boot_cpu_has(X86_FEATURE_SSBD))
763+
if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
764+
boot_cpu_has(X86_FEATURE_AMD_SSBD))
764765
entry->ebx |= F(AMD_SSBD);
765766
if (!boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS))
766767
entry->ebx |= F(AMD_SSB_NO);

0 commit comments

Comments
 (0)