Skip to content

Commit b3ffbbd

Browse files
committed
x86/CPU/AMD: Get rid of amd_erratum_400[]
Setting X86_BUG_AMD_E400 in init_amd() is early enough. 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 1709528 commit b3ffbbd

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ static u32 nodes_per_socket = 1;
5959
#define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff)
6060
#define AMD_MODEL_RANGE_END(range) ((range) & 0xfff)
6161

62-
static const int amd_erratum_400[] =
63-
AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),
64-
AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
65-
6662
static const int amd_erratum_1485[] =
6763
AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf),
6864
AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf));
@@ -765,15 +761,6 @@ static void early_init_amd(struct cpuinfo_x86 *c)
765761
if (c->x86 == 0x16 && c->x86_model <= 0xf)
766762
msr_set_bit(MSR_AMD64_LS_CFG, 15);
767763

768-
/*
769-
* Check whether the machine is affected by erratum 400. This is
770-
* used to select the proper idle routine and to enable the check
771-
* whether the machine is affected in arch_post_acpi_init(), which
772-
* sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check.
773-
*/
774-
if (cpu_has_amd_erratum(c, amd_erratum_400))
775-
set_cpu_bug(c, X86_BUG_AMD_E400);
776-
777764
early_detect_mem_encrypt(c);
778765

779766
/* Re-enable TopologyExtensions if switched off by BIOS */
@@ -840,6 +827,16 @@ static void init_amd_k8(struct cpuinfo_x86 *c)
840827
msr_set_bit(MSR_K7_HWCR, 6);
841828
#endif
842829
set_cpu_bug(c, X86_BUG_SWAPGS_FENCE);
830+
831+
/*
832+
* Check models and steppings affected by erratum 400. This is
833+
* used to select the proper idle routine and to enable the
834+
* check whether the machine is affected in arch_post_acpi_subsys_init()
835+
* which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check.
836+
*/
837+
if (c->x86_model > 0x41 ||
838+
(c->x86_model == 0x41 && c->x86_stepping >= 0x2))
839+
setup_force_cpu_bug(X86_BUG_AMD_E400);
843840
}
844841

845842
static void init_amd_gh(struct cpuinfo_x86 *c)
@@ -874,6 +871,16 @@ static void init_amd_gh(struct cpuinfo_x86 *c)
874871
msr_clear_bit(MSR_AMD64_BU_CFG2, 24);
875872

876873
set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
874+
875+
/*
876+
* Check models and steppings affected by erratum 400. This is
877+
* used to select the proper idle routine and to enable the
878+
* check whether the machine is affected in arch_post_acpi_subsys_init()
879+
* which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check.
880+
*/
881+
if (c->x86_model > 0x2 ||
882+
(c->x86_model == 0x2 && c->x86_stepping >= 0x1))
883+
setup_force_cpu_bug(X86_BUG_AMD_E400);
877884
}
878885

879886
static void init_amd_ln(struct cpuinfo_x86 *c)

0 commit comments

Comments
 (0)