aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-08 16:56:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-08 16:56:25 -0400
commit23adbe6fb571897b57c1f3dd952d598edce2f8e6 (patch)
tree401ac64fad518180fa1257b574613e1f4b57560e
parent6f27a64092ae0993e3389081673a258a4c926186 (diff)
parent612bc3b3d4be749f73a513a17d9b3ee1330d3487 (diff)
Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86/pti updates from Thomas Gleixner: "Two small fixes correcting the handling of SSB mitigations on AMD processors" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/bugs: Fix the AMD SSBD usage of the SPEC_CTRL MSR x86/bugs: Update when to check for the LS_CFG SSBD mitigation
-rw-r--r--arch/x86/kernel/cpu/amd.c4
-rw-r--r--arch/x86/kernel/cpu/bugs.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 082d7875cef8..38915fbfae73 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -543,7 +543,9 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
543 nodes_per_socket = ((value >> 3) & 7) + 1; 543 nodes_per_socket = ((value >> 3) & 7) + 1;
544 } 544 }
545 545
546 if (c->x86 >= 0x15 && c->x86 <= 0x17) { 546 if (!boot_cpu_has(X86_FEATURE_AMD_SSBD) &&
547 !boot_cpu_has(X86_FEATURE_VIRT_SSBD) &&
548 c->x86 >= 0x15 && c->x86 <= 0x17) {
547 unsigned int bit; 549 unsigned int bit;
548 550
549 switch (c->x86) { 551 switch (c->x86) {
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);