Skip to content

Commit 108fab4

Browse files
konradwilkKAGA-KOKO
authored andcommitted
x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features
Both AMD and Intel can have SPEC_CTRL_MSR for SSBD. However AMD also has two more other ways of doing it - which are !SPEC_CTRL MSR ways. Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Kees Cook <[email protected]> Cc: [email protected] Cc: KarimAllah Ahmed <[email protected]> Cc: [email protected] Cc: "H. Peter Anvin" <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: David Woodhouse <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 6ac2f49 commit 108fab4

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,17 +532,12 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)
532532
* Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may
533533
* use a completely different MSR and bit dependent on family.
534534
*/
535-
switch (boot_cpu_data.x86_vendor) {
536-
case X86_VENDOR_INTEL:
537-
case X86_VENDOR_AMD:
538-
if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) {
539-
x86_amd_ssb_disable();
540-
break;
541-
}
535+
if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL))
536+
x86_amd_ssb_disable();
537+
else {
542538
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
543539
x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
544540
wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
545-
break;
546541
}
547542
}
548543

0 commit comments

Comments
 (0)