Skip to content

Commit 23adbe6

Browse files
committed
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
2 parents 6f27a64 + 612bc3b commit 23adbe6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,9 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)
543543
nodes_per_socket = ((value >> 3) & 7) + 1;
544544
}
545545

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) {
547549
unsigned int bit;
548550

549551
switch (c->x86) {

arch/x86/kernel/cpu/bugs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
155155
guestval |= guest_spec_ctrl & x86_spec_ctrl_mask;
156156

157157
/* 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))
159160
hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
160161

161162
if (hostval != guestval) {
@@ -533,9 +534,10 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)
533534
* Intel uses the SPEC CTRL MSR Bit(2) for this, while AMD may
534535
* use a completely different MSR and bit dependent on family.
535536
*/
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)) {
537539
x86_amd_ssb_disable();
538-
else {
540+
} else {
539541
x86_spec_ctrl_base |= SPEC_CTRL_SSBD;
540542
x86_spec_ctrl_mask |= SPEC_CTRL_SSBD;
541543
wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);

0 commit comments

Comments
 (0)