Skip to content

Commit bfff3c6

Browse files
committed
x86/CPU/AMD: Move the DIV0 bug detection to the Zen1 init function
No functional changes. Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> Link: http://lore.kernel.org/r/[email protected]
1 parent f69759b commit bfff3c6

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ static const int amd_erratum_383[] =
7070
static const int amd_erratum_1054[] =
7171
AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0, 0, 0x2f, 0xf));
7272

73-
static const int amd_div0[] =
74-
AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x00, 0x0, 0x2f, 0xf),
75-
AMD_MODEL_RANGE(0x17, 0x50, 0x0, 0x5f, 0xf));
76-
7773
static const int amd_erratum_1485[] =
7874
AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf),
7975
AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf));
@@ -1030,6 +1026,9 @@ static void init_amd_zen(struct cpuinfo_x86 *c)
10301026
if (!cpu_has(c, X86_FEATURE_CPB))
10311027
set_cpu_cap(c, X86_FEATURE_CPB);
10321028
}
1029+
1030+
pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n");
1031+
setup_force_cpu_bug(X86_BUG_DIV0);
10331032
}
10341033

10351034
static bool cpu_has_zenbleed_microcode(void)
@@ -1067,7 +1066,6 @@ static void zen2_zenbleed_check(struct cpuinfo_x86 *c)
10671066
} else {
10681067
msr_clear_bit(MSR_AMD64_DE_CFG, MSR_AMD64_DE_CFG_ZEN2_FP_BACKUP_FIX_BIT);
10691068
}
1070-
10711069
}
10721070

10731071
static void init_amd_zen2(struct cpuinfo_x86 *c)
@@ -1219,11 +1217,6 @@ static void init_amd(struct cpuinfo_x86 *c)
12191217
cpu_has(c, X86_FEATURE_AUTOIBRS))
12201218
WARN_ON_ONCE(msr_set_bit(MSR_EFER, _EFER_AUTOIBRS));
12211219

1222-
if (cpu_has_amd_erratum(c, amd_div0)) {
1223-
pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n");
1224-
setup_force_cpu_bug(X86_BUG_DIV0);
1225-
}
1226-
12271220
if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
12281221
cpu_has_amd_erratum(c, amd_erratum_1485))
12291222
msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);

0 commit comments

Comments
 (0)