kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD
PATCH 1/2 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.
--- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +2 -1
@@ -402,7 +402,8 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) entry->edx |=F (SPEC_CTRL );if (boot_cpu_has (X86_FEATURE_STIBP )) entry->edx |=F (INTEL_STIBP ); -if (boot_cpu_has (X86_FEATURE_SSBD )) +if (boot_cpu_has (X86_FEATURE_SPEC_CTRL_SSBD ) || +boot_cpu_has (X86_FEATURE_AMD_SSBD )) entry->edx |=F (SPEC_CTRL_SSBD );/* * We emulate ARCH_CAPABILITIES in software even
Signature · 1 line
2.24.1.735.g03f4e72817-goog
PATCH 2/2 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.
--- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +2 -1
@@ -760,7 +760,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, entry->ebx |=F (AMD_IBRS );if (boot_cpu_has (X86_FEATURE_STIBP )) entry->ebx |=F (AMD_STIBP ); -if (boot_cpu_has (X86_FEATURE_SSBD )) +if (boot_cpu_has (X86_FEATURE_SPEC_CTRL_SSBD ) || +boot_cpu_has (X86_FEATURE_AMD_SSBD )) entry->ebx |=F (AMD_SSBD );if (!boot_cpu_has_bug (X86_BUG_SPEC_STORE_BYPASS )) entry->ebx |=F (AMD_SSB_NO );
Signature · 1 line
2.24.1.735.g03f4e72817-goog
Re: [PATCH 2/2] kvm: x86: Host feature SSBD doesn't imply guest feature AMD_SSBD
Quoted 1 line · Jim Mattson
[...]
Queued both, thanks.
Paolo