Commit fd258dc4 authored by Borislav Petkov's avatar Borislav Petkov

x86/mce: Add Skylake quirk for patrol scrub reported errors

The patrol scrubber in Skylake and Cascade Lake systems can be configured
to report uncorrected errors using a special signature in the machine
check bank and to signal using CMCI instead of machine check.

Update the severity calculation mechanism to allow specifying the model,
minimum stepping and range of machine check bank numbers.

Add a new rule to detect the special signature (on model 0x55, stepping
>=4 in any of the memory controller banks).

 [ bp: Rewrite it.
   aegl: Productize it. ]
Suggested-by: default avatarYouquan Song <youquan.song@intel.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Co-developed-by: default avatarTony Luck <tony.luck@intel.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200930021313.31810-2-tony.luck@intel.com
parent 4bd442e9
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <asm/mce.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/mce.h>
#include <asm/intel-family.h>
#include "internal.h" #include "internal.h"
/* /*
...@@ -40,9 +42,14 @@ static struct severity { ...@@ -40,9 +42,14 @@ static struct severity {
unsigned char context; unsigned char context;
unsigned char excp; unsigned char excp;
unsigned char covered; unsigned char covered;
unsigned char cpu_model;
unsigned char cpu_minstepping;
unsigned char bank_lo, bank_hi;
char *msg; char *msg;
} severities[] = { } severities[] = {
#define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c } #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c }
#define BANK_RANGE(l, h) .bank_lo = l, .bank_hi = h
#define MODEL_STEPPING(m, s) .cpu_model = m, .cpu_minstepping = s
#define KERNEL .context = IN_KERNEL #define KERNEL .context = IN_KERNEL
#define USER .context = IN_USER #define USER .context = IN_USER
#define KERNEL_RECOV .context = IN_KERNEL_RECOV #define KERNEL_RECOV .context = IN_KERNEL_RECOV
...@@ -97,7 +104,6 @@ static struct severity { ...@@ -97,7 +104,6 @@ static struct severity {
KEEP, "Corrected error", KEEP, "Corrected error",
NOSER, BITCLR(MCI_STATUS_UC) NOSER, BITCLR(MCI_STATUS_UC)
), ),
/* /*
* known AO MCACODs reported via MCE or CMC: * known AO MCACODs reported via MCE or CMC:
* *
...@@ -113,6 +119,18 @@ static struct severity { ...@@ -113,6 +119,18 @@ static struct severity {
AO, "Action optional: last level cache writeback error", AO, "Action optional: last level cache writeback error",
SER, MASK(MCI_UC_AR|MCACOD, MCI_STATUS_UC|MCACOD_L3WB) SER, MASK(MCI_UC_AR|MCACOD, MCI_STATUS_UC|MCACOD_L3WB)
), ),
/*
* Quirk for Skylake/Cascade Lake. Patrol scrubber may be configured
* to report uncorrected errors using CMCI with a special signature.
* UC=0, MSCOD=0x0010, MCACOD=binary(000X 0000 1100 XXXX) reported
* in one of the memory controller banks.
* Set severity to "AO" for same action as normal patrol scrub error.
*/
MCESEV(
AO, "Uncorrected Patrol Scrub Error",
SER, MASK(MCI_STATUS_UC|MCI_ADDR|0xffffeff0, MCI_ADDR|0x001000c0),
MODEL_STEPPING(INTEL_FAM6_SKYLAKE_X, 4), BANK_RANGE(13, 18)
),
/* ignore OVER for UCNA */ /* ignore OVER for UCNA */
MCESEV( MCESEV(
...@@ -324,6 +342,12 @@ static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_e ...@@ -324,6 +342,12 @@ static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_e
continue; continue;
if (s->excp && excp != s->excp) if (s->excp && excp != s->excp)
continue; continue;
if (s->cpu_model && boot_cpu_data.x86_model != s->cpu_model)
continue;
if (s->cpu_minstepping && boot_cpu_data.x86_stepping < s->cpu_minstepping)
continue;
if (s->bank_lo && (m->bank < s->bank_lo || m->bank > s->bank_hi))
continue;
if (msg) if (msg)
*msg = s->msg; *msg = s->msg;
s->covered = 1; s->covered = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment