diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2018-07-02 17:36:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2018-07-03 03:45:48 -0400 |
commit | 612bc3b3d4be749f73a513a17d9b3ee1330d3487 (patch) | |
tree | a10a1e57ce669e40a26ab23f7f3248dccb3787e7 /arch/x86/kernel/cpu/bugs.c | |
parent | 845d382bb15c6e7dc5026c0ff919c5b13fc7e11b (diff) |
x86/bugs: Fix the AMD SSBD usage of the SPEC_CTRL MSR
On AMD, the presence of the MSR_SPEC_CTRL feature does not imply that the
SSBD mitigation support should use the SPEC_CTRL MSR. Other features could
have caused the MSR_SPEC_CTRL feature to be set, while a different SSBD
mitigation option is in place.
Update the SSBD support to check for the actual SSBD features that will
use the SPEC_CTRL MSR.
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 6ac2f49edb1e ("x86/bugs: Add AMD's SPEC_CTRL MSR usage")
Link: http://lkml.kernel.org/r/20180702213602.29202.33151.stgit@tlendack-t1.amdoffice.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/bugs.c')
-rw-r--r-- | arch/x86/kernel/cpu/bugs.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 404df26b7de8..5c0ea39311fe 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
@@ -155,7 +155,8 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest) | |||
155 | guestval |= guest_spec_ctrl & x86_spec_ctrl_mask; | 155 | guestval |= guest_spec_ctrl & x86_spec_ctrl_mask; |
156 | 156 | ||
157 | /* SSBD controlled in MSR_SPEC_CTRL */ | 157 | /* SSBD controlled in MSR_SPEC_CTRL */ |
158 | if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD)) | 158 | if (static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) || |
159 | static_cpu_has(X86_FEATURE_AMD_SSBD)) | ||
159 | hostval |= ssbd_tif_to_spec_ctrl(ti->flags); | 160 | hostval |= ssbd_tif_to_spec_ctrl(ti->flags); |
160 | 161 | ||
161 | if (hostval != guestval) { | 162 | if (hostval != guestval) { |
@@ -533,9 +534,10 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void) | |||
533 | * Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may | 534 | * Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may |
534 | * use a completely different MSR and bit dependent on family. | 535 | * use a completely different MSR and bit dependent on family. |
535 | */ | 536 | */ |
536 | if (!static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) | 537 | if (!static_cpu_has(X86_FEATURE_SPEC_CTRL_SSBD) && |
538 | !static_cpu_has(X86_FEATURE_AMD_SSBD)) { | ||
537 | x86_amd_ssb_disable(); | 539 | x86_amd_ssb_disable(); |
538 | else { | 540 | } else { |
539 | x86_spec_ctrl_base |= SPEC_CTRL_SSBD; | 541 | x86_spec_ctrl_base |= SPEC_CTRL_SSBD; |
540 | x86_spec_ctrl_mask |= SPEC_CTRL_SSBD; | 542 | x86_spec_ctrl_mask |= SPEC_CTRL_SSBD; |
541 | wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); | 543 | wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base); |