KVM: x86: Add SBPB support
authorJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 25 Aug 2023 07:01:36 +0000 (00:01 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 4 Oct 2023 22:19:32 +0000 (15:19 -0700)
commite47d86083c66525b89c7fc66cdd64d5937725563
treec7a2a4b5ef893299a54ced0955ac5406f6011777
parent6f0f23ef76be11bc6ace10df5e807f3542da8772
KVM: x86: Add SBPB support

Add support for the AMD Selective Branch Predictor Barrier (SBPB) by
advertising the CPUID bit and handling PRED_CMD writes accordingly.

Note, like SRSO_NO and IBPB_BRTYPE before it, advertise support for SBPB
even if it's not enumerated by in the raw CPUID.  Some CPUs that gained
support via a uCode patch don't report SBPB via CPUID (the kernel forces
the flag).

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/a4ab1e7fe50096d50fde33e739ed2da40b41ea6a.1692919072.git.jpoimboe@kernel.org
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/cpuid.h
arch/x86/kvm/x86.c