Skip to content

Commit 4a5f2dd

Browse files
aeglbp3tk0v
authored andcommitted
x86/mce: Switch to new Intel CPU model defines
New CPU #defines encode vendor and family as well as model. [ bp: Squash *three* mce patches into one, fold in fix: https://lore.kernel.org/r/[email protected] ] Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/all/20240424181511.41772-1-tony.luck%40intel.com
1 parent c73cd37 commit 4a5f2dd

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#include <linux/kexec.h>
4848

4949
#include <asm/fred.h>
50-
#include <asm/intel-family.h>
50+
#include <asm/cpu_device_id.h>
5151
#include <asm/processor.h>
5252
#include <asm/traps.h>
5353
#include <asm/tlbflush.h>
@@ -1948,14 +1948,14 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
19481948
if (c->x86 == 6 && c->x86_model <= 13 && cfg->bootlog < 0)
19491949
cfg->bootlog = 0;
19501950

1951-
if (c->x86 == 6 && c->x86_model == 45)
1951+
if (c->x86_vfm == INTEL_SANDYBRIDGE_X)
19521952
mce_flags.snb_ifu_quirk = 1;
19531953

19541954
/*
19551955
* Skylake, Cascacde Lake and Cooper Lake require a quirk on
19561956
* rep movs.
19571957
*/
1958-
if (c->x86 == 6 && c->x86_model == INTEL_FAM6_SKYLAKE_X)
1958+
if (c->x86_vfm == INTEL_SKYLAKE_X)
19591959
mce_flags.skx_repmov_quirk = 1;
19601960
}
19611961

arch/x86/kernel/cpu/mce/intel.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <linux/cpumask.h>
1414
#include <asm/apic.h>
1515
#include <asm/cpufeature.h>
16-
#include <asm/intel-family.h>
16+
#include <asm/cpu_device_id.h>
1717
#include <asm/processor.h>
1818
#include <asm/msr.h>
1919
#include <asm/mce.h>
@@ -455,10 +455,10 @@ static void intel_imc_init(struct cpuinfo_x86 *c)
455455
{
456456
u64 error_control;
457457

458-
switch (c->x86_model) {
459-
case INTEL_FAM6_SANDYBRIDGE_X:
460-
case INTEL_FAM6_IVYBRIDGE_X:
461-
case INTEL_FAM6_HASWELL_X:
458+
switch (c->x86_vfm) {
459+
case INTEL_SANDYBRIDGE_X:
460+
case INTEL_IVYBRIDGE_X:
461+
case INTEL_HASWELL_X:
462462
if (rdmsrl_safe(MSR_ERROR_CONTROL, &error_control))
463463
return;
464464
error_control |= 2;
@@ -484,12 +484,11 @@ bool intel_filter_mce(struct mce *m)
484484
struct cpuinfo_x86 *c = &boot_cpu_data;
485485

486486
/* MCE errata HSD131, HSM142, HSW131, BDM48, HSM142 and SKX37 */
487-
if ((c->x86 == 6) &&
488-
((c->x86_model == INTEL_FAM6_HASWELL) ||
489-
(c->x86_model == INTEL_FAM6_HASWELL_L) ||
490-
(c->x86_model == INTEL_FAM6_BROADWELL) ||
491-
(c->x86_model == INTEL_FAM6_HASWELL_G) ||
492-
(c->x86_model == INTEL_FAM6_SKYLAKE_X)) &&
487+
if ((c->x86_vfm == INTEL_HASWELL ||
488+
c->x86_vfm == INTEL_HASWELL_L ||
489+
c->x86_vfm == INTEL_BROADWELL ||
490+
c->x86_vfm == INTEL_HASWELL_G ||
491+
c->x86_vfm == INTEL_SKYLAKE_X) &&
493492
(m->bank == 0) &&
494493
((m->status & 0xa0000000ffffffff) == 0x80000000000f0005))
495494
return true;

arch/x86/kernel/cpu/mce/severity.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <linux/uaccess.h>
1313

1414
#include <asm/mce.h>
15-
#include <asm/intel-family.h>
15+
#include <asm/cpu_device_id.h>
1616
#include <asm/traps.h>
1717
#include <asm/insn.h>
1818
#include <asm/insn-eval.h>
@@ -45,14 +45,14 @@ static struct severity {
4545
unsigned char context;
4646
unsigned char excp;
4747
unsigned char covered;
48-
unsigned char cpu_model;
48+
unsigned int cpu_vfm;
4949
unsigned char cpu_minstepping;
5050
unsigned char bank_lo, bank_hi;
5151
char *msg;
5252
} severities[] = {
5353
#define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c }
5454
#define BANK_RANGE(l, h) .bank_lo = l, .bank_hi = h
55-
#define MODEL_STEPPING(m, s) .cpu_model = m, .cpu_minstepping = s
55+
#define VFM_STEPPING(m, s) .cpu_vfm = m, .cpu_minstepping = s
5656
#define KERNEL .context = IN_KERNEL
5757
#define USER .context = IN_USER
5858
#define KERNEL_RECOV .context = IN_KERNEL_RECOV
@@ -128,7 +128,7 @@ static struct severity {
128128
MCESEV(
129129
AO, "Uncorrected Patrol Scrub Error",
130130
SER, MASK(MCI_STATUS_UC|MCI_ADDR|0xffffeff0, MCI_ADDR|0x001000c0),
131-
MODEL_STEPPING(INTEL_FAM6_SKYLAKE_X, 4), BANK_RANGE(13, 18)
131+
VFM_STEPPING(INTEL_SKYLAKE_X, 4), BANK_RANGE(13, 18)
132132
),
133133

134134
/* ignore OVER for UCNA */
@@ -398,7 +398,7 @@ static noinstr int mce_severity_intel(struct mce *m, struct pt_regs *regs, char
398398
continue;
399399
if (s->excp && excp != s->excp)
400400
continue;
401-
if (s->cpu_model && boot_cpu_data.x86_model != s->cpu_model)
401+
if (s->cpu_vfm && boot_cpu_data.x86_vfm != s->cpu_vfm)
402402
continue;
403403
if (s->cpu_minstepping && boot_cpu_data.x86_stepping < s->cpu_minstepping)
404404
continue;

0 commit comments

Comments
 (0)