Skip to content

Commit 0c49195

Browse files
jsmattsonjrgregkh
authored andcommitted
kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD
commit 396d2e8 upstream. 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]> Reported-by: Eric Biggers <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> [bwh: Backported to 4.x: adjust indentation] Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e0a272f commit 0c49195

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
@@ -479,7 +479,8 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
479479
entry->edx |= F(SPEC_CTRL);
480480
if (boot_cpu_has(X86_FEATURE_STIBP))
481481
entry->edx |= F(INTEL_STIBP);
482-
if (boot_cpu_has(X86_FEATURE_SSBD))
482+
if (boot_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) ||
483+
boot_cpu_has(X86_FEATURE_AMD_SSBD))
483484
entry->edx |= F(SPEC_CTRL_SSBD);
484485
/*
485486
* We emulate ARCH_CAPABILITIES in software even

0 commit comments

Comments
 (0)