Skip to content

Commit

Permalink
x86/bugs: Switch the selection of mitigation from CPU vendor to CPU f…
Browse files Browse the repository at this point in the history
…eatures

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]
  • Loading branch information
konradwilk authored and KAGA-KOKO committed Jun 6, 2018
1 parent 6ac2f49 commit 108fab4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions arch/x86/kernel/cpu/bugs.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,12 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)
* Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may
* use a completely different MSR and bit dependent on family.
*/
switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL:
case X86_VENDOR_AMD:
if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) {
x86_amd_ssb_disable();
break;
}
if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL))
x86_amd_ssb_disable();
else {
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
break;
}
}

Expand Down

0 comments on commit 108fab4

Please sign in to comment.