Skip to content

Commit 6f0f23e

Browse files
jpoimboesean-jc
authored andcommitted
KVM: x86: Add IBPB_BRTYPE support
Add support for the IBPB_BRTYPE CPUID flag, which indicates that IBPB includes branch type prediction flushing. Note, like SRSO_NO, advertise support for IBPB_BRTYPE even if it's not enumerated by in the raw CPUID, i.e. bypass the cpuid_count() in __kvm_cpu_cap_mask(). Some CPUs that gained support via a uCode patch don't report IBPB_BRTYPE via CPUID (the kernel forces the flag). Opportunistically use kvm_cpu_cap_check_and_set() for SRSO_NO instead of manually querying host support (cpu_feature_enabled() and boot_cpu_has() yield the same end result in this case). Signed-off-by: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/79d5f5914fb42c2c62418ffbcd78f138645ded21.1692919072.git.jpoimboe@kernel.org Signed-off-by: Sean Christopherson <[email protected]>
1 parent f10a570 commit 6f0f23e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ void kvm_set_cpu_caps(void)
764764
F(NULL_SEL_CLR_BASE) | F(AUTOIBRS) | 0 /* PrefetchCtlMsr */
765765
);
766766

767-
if (cpu_feature_enabled(X86_FEATURE_SRSO_NO))
768-
kvm_cpu_cap_set(X86_FEATURE_SRSO_NO);
767+
kvm_cpu_cap_check_and_set(X86_FEATURE_IBPB_BRTYPE);
768+
kvm_cpu_cap_check_and_set(X86_FEATURE_SRSO_NO);
769769

770770
kvm_cpu_cap_init_kvm_defined(CPUID_8000_0022_EAX,
771771
F(PERFMON_V2)

0 commit comments

Comments
 (0)