Skip to content

Commit fe48d03

Browse files
aeglgregkh
authored andcommitted
x86/cpu/intel: Switch to new Intel CPU model defines
[ Upstream commit 6568fc1 ] 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 Stable-dep-of: c9a4b55 ("x86/cpu: Add Lunar Lake to list of CPUs with a broken MONITOR implementation") Signed-off-by: Sasha Levin <[email protected]>
1 parent d7ac185 commit fe48d03

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
}
@@ -312,7 +309,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
312309
* need the microcode to have already been loaded... so if it is
313310
* not, recommend a BIOS update and disable large pages.
314311
*/
315-
if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_stepping <= 2 &&
312+
if (c->x86_vfm == INTEL_ATOM_BONNELL && c->x86_stepping <= 2 &&
316313
c->microcode < 0x20e) {
317314
pr_warn("Atom PSE erratum detected, BIOS microcode update recommended\n");
318315
clear_cpu_cap(c, X86_FEATURE_PSE);
@@ -345,11 +342,11 @@ static void early_init_intel(struct cpuinfo_x86 *c)
345342

346343
/* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
347344
if (c->x86 == 6) {
348-
switch (c->x86_model) {
349-
case INTEL_FAM6_ATOM_SALTWELL_MID:
350-
case INTEL_FAM6_ATOM_SALTWELL_TABLET:
351-
case INTEL_FAM6_ATOM_SILVERMONT_MID:
352-
case INTEL_FAM6_ATOM_AIRMONT_NP:
345+
switch (c->x86_vfm) {
346+
case INTEL_ATOM_SALTWELL_MID:
347+
case INTEL_ATOM_SALTWELL_TABLET:
348+
case INTEL_ATOM_SILVERMONT_MID:
349+
case INTEL_ATOM_AIRMONT_NP:
353350
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3);
354351
break;
355352
default:
@@ -393,7 +390,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
393390
* should be false so that __flush_tlb_all() causes CR3 instead of CR4.PGE
394391
* to be modified.
395392
*/
396-
if (c->x86 == 5 && c->x86_model == 9) {
393+
if (c->x86_vfm == INTEL_QUARK_X1000) {
397394
pr_info("Disabling PGE capability bit\n");
398395
setup_clear_cpu_cap(X86_FEATURE_PGE);
399396
}
@@ -663,12 +660,13 @@ static void init_intel(struct cpuinfo_x86 *c)
663660
set_cpu_cap(c, X86_FEATURE_PEBS);
664661
}
665662

666-
if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_CLFLUSH) &&
667-
(c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
663+
if (boot_cpu_has(X86_FEATURE_CLFLUSH) &&
664+
(c->x86_vfm == INTEL_CORE2_DUNNINGTON ||
665+
c->x86_vfm == INTEL_NEHALEM_EX ||
666+
c->x86_vfm == INTEL_WESTMERE_EX))
668667
set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);
669668

670-
if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_MWAIT) &&
671-
((c->x86_model == INTEL_FAM6_ATOM_GOLDMONT)))
669+
if (boot_cpu_has(X86_FEATURE_MWAIT) && c->x86_vfm == INTEL_ATOM_GOLDMONT)
672670
set_cpu_bug(c, X86_BUG_MONITOR);
673671

674672
#ifdef CONFIG_X86_64
@@ -1285,9 +1283,9 @@ void handle_bus_lock(struct pt_regs *regs)
12851283
* feature even though they do not enumerate IA32_CORE_CAPABILITIES.
12861284
*/
12871285
static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = {
1288-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, 0),
1289-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L, 0),
1290-
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, 0),
1286+
X86_MATCH_VFM(INTEL_ICELAKE_X, 0),
1287+
X86_MATCH_VFM(INTEL_ICELAKE_L, 0),
1288+
X86_MATCH_VFM(INTEL_ICELAKE_D, 0),
12911289
{}
12921290
};
12931291

0 commit comments

Comments
 (0)