summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/amd.c
diff options
context:
space:
mode:
authorBorislav Petkov (AMD) <bp@alien8.de>2023-06-29 17:43:40 +0200
committerBorislav Petkov (AMD) <bp@alien8.de>2023-07-27 11:07:19 +0200
commit1b5277c0ea0b247393a9c426769fde18cff5e2f6 (patch)
treea7b68ae056148d5304ca880ec781d80bdf41595c /arch/x86/kernel/cpu/amd.c
parent79113e4060aba744787a81edb9014f2865193854 (diff)
downloadlinux-1b5277c0ea0b247393a9c426769fde18cff5e2f6.tar.gz
linux-1b5277c0ea0b247393a9c426769fde18cff5e2f6.tar.bz2
linux-1b5277c0ea0b247393a9c426769fde18cff5e2f6.zip
x86/srso: Add SRSO_NO support
Add support for the CPUID flag which denotes that the CPU is not affected by SRSO. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r--arch/x86/kernel/cpu/amd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 169cb255c483..834f310b2f1a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1240,12 +1240,12 @@ bool cpu_has_ibpb_brtype_microcode(void)
{
u8 fam = boot_cpu_data.x86;
- if (fam == 0x17) {
- /* Zen1/2 IBPB flushes branch type predictions too. */
+ /* Zen1/2 IBPB flushes branch type predictions too. */
+ if (fam == 0x17)
return boot_cpu_has(X86_FEATURE_AMD_IBPB);
- } else if (fam == 0x19) {
+ /* Poke the MSR bit on Zen3/4 to check its presence. */
+ else if (fam == 0x19)
+ return !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB);
+ else
return false;
- }
-
- return false;
}