Skip to content

Commit 396d2e8

Browse files
jsmattsonjrbonzini
authored andcommitted
kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_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.(EAX=7,ECX=0):EDX.SSBD[bit 31] 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: 0c54914 ("KVM: x86: use Intel speculation bugs and features as derived in generic x86 code") 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 b07a5c5 commit 396d2e8

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
@@ -402,7 +402,8 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index)
402402
entry->edx |= F(SPEC_CTRL);
403403
if (boot_cpu_has(X86_FEATURE_STIBP))
404404
entry->edx |= F(INTEL_STIBP);
405-
if (boot_cpu_has(X86_FEATURE_SSBD))
405+
if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
406+
boot_cpu_has(X86_FEATURE_AMD_SSBD))
406407
entry->edx |= F(SPEC_CTRL_SSBD);
407408
/*
408409
* We emulate ARCH_CAPABILITIES in software even

0 commit comments

Comments
 (0)