Skip to content

Commit 6568fc1

Browse files
aeglhansendc
authored andcommitted
x86/cpu/intel: Switch to new Intel CPU model defines
New CPU #defines encode vendor and family as well as model. Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20240520224620.9480-29-tony.luck%40intel.com
1 parent 2cf615a commit 6568fc1

File tree

1 file changed

+53
-55
lines changed

1 file changed

+53
-55
lines changed

arch/x86/kernel/cpu/intel.c

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ static bool cpu_model_supports_sld __ro_after_init;
7272
*/
7373
static void check_memory_type_self_snoop_errata(struct cpuinfo_x86 *c)
7474
{
75-
switch (c->x86_model) {
76-
case INTEL_FAM6_CORE_YONAH:
77-
case INTEL_FAM6_CORE2_MEROM:
78-
case INTEL_FAM6_CORE2_MEROM_L:
79-
case INTEL_FAM6_CORE2_PENRYN:
80-
case INTEL_FAM6_CORE2_DUNNINGTON:
81-
case INTEL_FAM6_NEHALEM:
82-
case INTEL_FAM6_NEHALEM_G:
83-
case INTEL_FAM6_NEHALEM_EP:
84-
case INTEL_FAM6_NEHALEM_EX:
85-
case INTEL_FAM6_WESTMERE:
86-
case INTEL_FAM6_WESTMERE_EP:
87-
case INTEL_FAM6_SANDYBRIDGE:
75+
switch (c->x86_vfm) {
76+
case INTEL_CORE_YONAH:
77+
case INTEL_CORE2_MEROM:
78+
case INTEL_CORE2_MEROM_L:
79+
case INTEL_CORE2_PENRYN:
80+
case INTEL_CORE2_DUNNINGTON:
81+
case INTEL_NEHALEM:
82+
case INTEL_NEHALEM_G:
83+
case INTEL_NEHALEM_EP:
84+
case INTEL_NEHALEM_EX:
85+
case INTEL_WESTMERE:
86+
case INTEL_WESTMERE_EP:
87+
case INTEL_SANDYBRIDGE:
8888
setup_clear_cpu_cap(X86_FEATURE_SELFSNOOP);
8989
}
9090
}
@@ -106,9 +106,9 @@ static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c)
106106
*/
107107
if (c->x86 != 6)
108108
return;
109-
switch (c->x86_model) {
110-
case INTEL_FAM6_XEON_PHI_KNL:
111-
case INTEL_FAM6_XEON_PHI_KNM:
109+
switch (c->x86_vfm) {
110+
case INTEL_XEON_PHI_KNL:
111+
case INTEL_XEON_PHI_KNM:
112112
break;
113113
default:
114114
return;
@@ -134,32 +134,32 @@ static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c)
134134
* - Release note from 20180108 microcode release
135135
*/
136136
struct sku_microcode {
137-
u8 model;
137+
u32 vfm;
138138
u8 stepping;
139139
u32 microcode;
140140
};
141141
static const struct sku_microcode spectre_bad_microcodes[] = {
142-
{ INTEL_FAM6_KABYLAKE, 0x0B, 0x80 },
143-
{ INTEL_FAM6_KABYLAKE, 0x0A, 0x80 },
144-
{ INTEL_FAM6_KABYLAKE, 0x09, 0x80 },
145-
{ INTEL_FAM6_KABYLAKE_L, 0x0A, 0x80 },
146-
{ INTEL_FAM6_KABYLAKE_L, 0x09, 0x80 },
147-
{ INTEL_FAM6_SKYLAKE_X, 0x03, 0x0100013e },
148-
{ INTEL_FAM6_SKYLAKE_X, 0x04, 0x0200003c },
149-
{ INTEL_FAM6_BROADWELL, 0x04, 0x28 },
150-
{ INTEL_FAM6_BROADWELL_G, 0x01, 0x1b },
151-
{ INTEL_FAM6_BROADWELL_D, 0x02, 0x14 },
152-
{ INTEL_FAM6_BROADWELL_D, 0x03, 0x07000011 },
153-
{ INTEL_FAM6_BROADWELL_X, 0x01, 0x0b000025 },
154-
{ INTEL_FAM6_HASWELL_L, 0x01, 0x21 },
155-
{ INTEL_FAM6_HASWELL_G, 0x01, 0x18 },
156-
{ INTEL_FAM6_HASWELL, 0x03, 0x23 },
157-
{ INTEL_FAM6_HASWELL_X, 0x02, 0x3b },
158-
{ INTEL_FAM6_HASWELL_X, 0x04, 0x10 },
159-
{ INTEL_FAM6_IVYBRIDGE_X, 0x04, 0x42a },
142+
{ INTEL_KABYLAKE, 0x0B, 0x80 },
143+
{ INTEL_KABYLAKE, 0x0A, 0x80 },
144+
{ INTEL_KABYLAKE, 0x09, 0x80 },
145+
{ INTEL_KABYLAKE_L, 0x0A, 0x80 },
146+
{ INTEL_KABYLAKE_L, 0x09, 0x80 },
147+
{ INTEL_SKYLAKE_X, 0x03, 0x0100013e },
148+
{ INTEL_SKYLAKE_X, 0x04, 0x0200003c },
149+
{ INTEL_BROADWELL, 0x04, 0x28 },
150+
{ INTEL_BROADWELL_G, 0x01, 0x1b },
151+
{ INTEL_BROADWELL_D, 0x02, 0x14 },
152+
{ INTEL_BROADWELL_D, 0x03, 0x07000011 },
153+
{ INTEL_BROADWELL_X, 0x01, 0x0b000025 },
154+
{ INTEL_HASWELL_L, 0x01, 0x21 },
155+
{ INTEL_HASWELL_G, 0x01, 0x18 },
156+
{ INTEL_HASWELL, 0x03, 0x23 },
157+
{ INTEL_HASWELL_X, 0x02, 0x3b },
158+
{ INTEL_HASWELL_X, 0x04, 0x10 },
159+
{ INTEL_IVYBRIDGE_X, 0x04, 0x42a },
160160
/* Observed in the wild */
161-
{ INTEL_FAM6_SANDYBRIDGE_X, 0x06, 0x61b },
162-
{ INTEL_FAM6_SANDYBRIDGE_X, 0x07, 0x712 },
161+
{ INTEL_SANDYBRIDGE_X, 0x06, 0x61b },
162+
{ INTEL_SANDYBRIDGE_X, 0x07, 0x712 },
163163
};
164164

165165
static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
@@ -173,11 +173,8 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c)
173173
if (cpu_has(c, X86_FEATURE_HYPERVISOR))
174174
return false;
175175

176-
if (c->x86 != 6)
177-
return false;
178-
179176
for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
180-
if (c->x86_model == spectre_bad_microcodes[i].model &&
177+
if (c->x86_vfm == spectre_bad_microcodes[i].vfm &&
181178
c->x86_stepping == spectre_bad_microcodes[i].stepping)
182179
return (c->microcode <= spectre_bad_microcodes[i].microcode);
183180
}
@@ -265,7 +262,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
265262
* need the microcode to have already been loaded... so if it is
266263
* not, recommend a BIOS update and disable large pages.
267264
*/
268-
if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_stepping <= 2 &&
265+
if (c->x86_vfm == INTEL_ATOM_BONNELL && c->x86_stepping <= 2 &&
269266
c->microcode < 0x20e) {
270267
pr_warn("Atom PSE erratum detected, BIOS microcode update recommended\n");
271268
clear_cpu_cap(c, X86_FEATURE_PSE);
@@ -298,11 +295,11 @@ static void early_init_intel(struct cpuinfo_x86 *c)
298295

299296
/* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
300297
if (c->x86 == 6) {
301-
switch (c->x86_model) {
302-
case INTEL_FAM6_ATOM_SALTWELL_MID:
303-
case INTEL_FAM6_ATOM_SALTWELL_TABLET:
304-
case INTEL_FAM6_ATOM_SILVERMONT_MID:
305-
case INTEL_FAM6_ATOM_AIRMONT_NP:
298+
switch (c->x86_vfm) {
299+
case INTEL_ATOM_SALTWELL_MID:
300+
case INTEL_ATOM_SALTWELL_TABLET:
301+
case INTEL_ATOM_SILVERMONT_MID:
302+
case INTEL_ATOM_AIRMONT_NP:
306303
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3);
307304
break;
308305
default:
@@ -346,7 +343,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
346343
* should be false so that __flush_tlb_all() causes CR3 instead of CR4.PGE
347344
* to be modified.
348345
*/
349-
if (c->x86 == 5 && c->x86_model == 9) {
346+
if (c->x86_vfm == INTEL_QUARK_X1000) {
350347
pr_info("Disabling PGE capability bit\n");
351348
setup_clear_cpu_cap(X86_FEATURE_PGE);
352349
}
@@ -578,12 +575,13 @@ static void init_intel(struct cpuinfo_x86 *c)
578575
set_cpu_cap(c, X86_FEATURE_PEBS);
579576
}
580577

581-
if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_CLFLUSH) &&
582-
(c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
578+
if (boot_cpu_has(X86_FEATURE_CLFLUSH) &&
579+
(c->x86_vfm == INTEL_CORE2_DUNNINGTON ||
580+
c->x86_vfm == INTEL_NEHALEM_EX ||
581+
c->x86_vfm == INTEL_WESTMERE_EX))
583582
set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);
584583

585-
if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_MWAIT) &&
586-
((c->x86_model == INTEL_FAM6_ATOM_GOLDMONT)))
584+
if (boot_cpu_has(X86_FEATURE_MWAIT) && c->x86_vfm == INTEL_ATOM_GOLDMONT)
587585
set_cpu_bug(c, X86_BUG_MONITOR);
588586

589587
#ifdef CONFIG_X86_64
@@ -1199,9 +1197,9 @@ void handle_bus_lock(struct pt_regs *regs)
11991197
* feature even though they do not enumerate IA32_CORE_CAPABILITIES.
12001198
*/
12011199
static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = {
1202-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, 0),
1203-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, 0),
1204-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, 0),
1200+
X86_MATCH_VFM(INTEL_ICELAKE_X, 0),
1201+
X86_MATCH_VFM(INTEL_ICELAKE_L, 0),
1202+
X86_MATCH_VFM(INTEL_ICELAKE_D, 0),
12051203
{}
12061204
};
12071205

0 commit comments

Comments
 (0)