Commit 7c6582b2 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, mce: Use mce_sysdev_ prefix to group functions
  x86, mce: Use mce_chrdev_ prefix to group functions
  x86, mce: Cleanup mce_read()
  x86, mce: Cleanup mce_create()/remove_device()
  x86, mce: Check the result of ancient_init()
  x86, mce: Introduce mce_gather_info()
  x86, mce: Replace MCM_ with MCI_MISC_
  x86, mce: Replace MCE_SELF_VECTOR by irq_work
  x86, mce, severity: Clean up trivial coding style problems
  x86, mce, severity: Cleanup severity table
  x86, mce, severity: Make formatting a bit more readable
  x86, mce, severity: Fix two severities table signatures
parents 227ad9bc c7cece89
...@@ -53,8 +53,4 @@ BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) ...@@ -53,8 +53,4 @@ BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
BUILD_INTERRUPT(threshold_interrupt,THRESHOLD_APIC_VECTOR) BUILD_INTERRUPT(threshold_interrupt,THRESHOLD_APIC_VECTOR)
#endif #endif
#ifdef CONFIG_X86_MCE
BUILD_INTERRUPT(mce_self_interrupt,MCE_SELF_VECTOR)
#endif
#endif #endif
...@@ -34,7 +34,6 @@ extern void irq_work_interrupt(void); ...@@ -34,7 +34,6 @@ extern void irq_work_interrupt(void);
extern void spurious_interrupt(void); extern void spurious_interrupt(void);
extern void thermal_interrupt(void); extern void thermal_interrupt(void);
extern void reschedule_interrupt(void); extern void reschedule_interrupt(void);
extern void mce_self_interrupt(void);
extern void invalidate_interrupt(void); extern void invalidate_interrupt(void);
extern void invalidate_interrupt0(void); extern void invalidate_interrupt0(void);
......
...@@ -109,11 +109,6 @@ ...@@ -109,11 +109,6 @@
#define UV_BAU_MESSAGE 0xf5 #define UV_BAU_MESSAGE 0xf5
/*
* Self IPI vector for machine checks
*/
#define MCE_SELF_VECTOR 0xf4
/* Xen vector callback to receive events in a HVM domain */ /* Xen vector callback to receive events in a HVM domain */
#define XEN_HVM_EVTCHN_CALLBACK 0xf3 #define XEN_HVM_EVTCHN_CALLBACK 0xf3
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Machine Check support for x86 * Machine Check support for x86
*/ */
/* MCG_CAP register defines */
#define MCG_BANKCNT_MASK 0xff /* Number of Banks */ #define MCG_BANKCNT_MASK 0xff /* Number of Banks */
#define MCG_CTL_P (1ULL<<8) /* MCG_CTL register available */ #define MCG_CTL_P (1ULL<<8) /* MCG_CTL register available */
#define MCG_EXT_P (1ULL<<9) /* Extended registers available */ #define MCG_EXT_P (1ULL<<9) /* Extended registers available */
...@@ -17,10 +18,12 @@ ...@@ -17,10 +18,12 @@
#define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT) #define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT)
#define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */ #define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */
/* MCG_STATUS register defines */
#define MCG_STATUS_RIPV (1ULL<<0) /* restart ip valid */ #define MCG_STATUS_RIPV (1ULL<<0) /* restart ip valid */
#define MCG_STATUS_EIPV (1ULL<<1) /* ip points to correct instruction */ #define MCG_STATUS_EIPV (1ULL<<1) /* ip points to correct instruction */
#define MCG_STATUS_MCIP (1ULL<<2) /* machine check in progress */ #define MCG_STATUS_MCIP (1ULL<<2) /* machine check in progress */
/* MCi_STATUS register defines */
#define MCI_STATUS_VAL (1ULL<<63) /* valid error */ #define MCI_STATUS_VAL (1ULL<<63) /* valid error */
#define MCI_STATUS_OVER (1ULL<<62) /* previous errors lost */ #define MCI_STATUS_OVER (1ULL<<62) /* previous errors lost */
#define MCI_STATUS_UC (1ULL<<61) /* uncorrected error */ #define MCI_STATUS_UC (1ULL<<61) /* uncorrected error */
...@@ -31,12 +34,14 @@ ...@@ -31,12 +34,14 @@
#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */ #define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */
#define MCI_STATUS_AR (1ULL<<55) /* Action required */ #define MCI_STATUS_AR (1ULL<<55) /* Action required */
/* MISC register defines */ /* MCi_MISC register defines */
#define MCM_ADDR_SEGOFF 0 /* segment offset */ #define MCI_MISC_ADDR_LSB(m) ((m) & 0x3f)
#define MCM_ADDR_LINEAR 1 /* linear address */ #define MCI_MISC_ADDR_MODE(m) (((m) >> 6) & 7)
#define MCM_ADDR_PHYS 2 /* physical address */ #define MCI_MISC_ADDR_SEGOFF 0 /* segment offset */
#define MCM_ADDR_MEM 3 /* memory address */ #define MCI_MISC_ADDR_LINEAR 1 /* linear address */
#define MCM_ADDR_GENERIC 7 /* generic */ #define MCI_MISC_ADDR_PHYS 2 /* physical address */
#define MCI_MISC_ADDR_MEM 3 /* memory address */
#define MCI_MISC_ADDR_GENERIC 7 /* generic */
/* CTL2 register defines */ /* CTL2 register defines */
#define MCI_CTL2_CMCI_EN (1ULL << 30) #define MCI_CTL2_CMCI_EN (1ULL << 30)
...@@ -144,7 +149,7 @@ static inline void enable_p5_mce(void) {} ...@@ -144,7 +149,7 @@ static inline void enable_p5_mce(void) {}
void mce_setup(struct mce *m); void mce_setup(struct mce *m);
void mce_log(struct mce *m); void mce_log(struct mce *m);
DECLARE_PER_CPU(struct sys_device, mce_dev); DECLARE_PER_CPU(struct sys_device, mce_sysdev);
/* /*
* Maximum banks number. * Maximum banks number.
......
...@@ -43,61 +43,105 @@ static struct severity { ...@@ -43,61 +43,105 @@ static struct severity {
unsigned char covered; unsigned char covered;
char *msg; char *msg;
} severities[] = { } severities[] = {
#define KERNEL .context = IN_KERNEL #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c }
#define USER .context = IN_USER #define KERNEL .context = IN_KERNEL
#define SER .ser = SER_REQUIRED #define USER .context = IN_USER
#define NOSER .ser = NO_SER #define SER .ser = SER_REQUIRED
#define SEV(s) .sev = MCE_ ## s ## _SEVERITY #define NOSER .ser = NO_SER
#define BITCLR(x, s, m, r...) { .mask = x, .result = 0, SEV(s), .msg = m, ## r } #define BITCLR(x) .mask = x, .result = 0
#define BITSET(x, s, m, r...) { .mask = x, .result = x, SEV(s), .msg = m, ## r } #define BITSET(x) .mask = x, .result = x
#define MCGMASK(x, res, s, m, r...) \ #define MCGMASK(x, y) .mcgmask = x, .mcgres = y
{ .mcgmask = x, .mcgres = res, SEV(s), .msg = m, ## r } #define MASK(x, y) .mask = x, .result = y
#define MASK(x, y, s, m, r...) \
{ .mask = x, .result = y, SEV(s), .msg = m, ## r }
#define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S) #define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S)
#define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR) #define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR)
#define MCACOD 0xffff #define MCACOD 0xffff
BITCLR(MCI_STATUS_VAL, NO, "Invalid"), MCESEV(
BITCLR(MCI_STATUS_EN, NO, "Not enabled"), NO, "Invalid",
BITSET(MCI_STATUS_PCC, PANIC, "Processor context corrupt"), BITCLR(MCI_STATUS_VAL)
),
MCESEV(
NO, "Not enabled",
BITCLR(MCI_STATUS_EN)
),
MCESEV(
PANIC, "Processor context corrupt",
BITSET(MCI_STATUS_PCC)
),
/* When MCIP is not set something is very confused */ /* When MCIP is not set something is very confused */
MCGMASK(MCG_STATUS_MCIP, 0, PANIC, "MCIP not set in MCA handler"), MCESEV(
PANIC, "MCIP not set in MCA handler",
MCGMASK(MCG_STATUS_MCIP, 0)
),
/* Neither return not error IP -- no chance to recover -> PANIC */ /* Neither return not error IP -- no chance to recover -> PANIC */
MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0, PANIC, MCESEV(
"Neither restart nor error IP"), PANIC, "Neither restart nor error IP",
MCGMASK(MCG_STATUS_RIPV, 0, PANIC, "In kernel and no restart IP", MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0)
KERNEL), ),
BITCLR(MCI_STATUS_UC, KEEP, "Corrected error", NOSER), MCESEV(
MASK(MCI_STATUS_OVER|MCI_STATUS_UC|MCI_STATUS_EN, MCI_STATUS_UC, SOME, PANIC, "In kernel and no restart IP",
"Spurious not enabled", SER), KERNEL, MCGMASK(MCG_STATUS_RIPV, 0)
),
MCESEV(
KEEP, "Corrected error",
NOSER, BITCLR(MCI_STATUS_UC)
),
/* ignore OVER for UCNA */ /* ignore OVER for UCNA */
MASK(MCI_UC_SAR, MCI_STATUS_UC, KEEP, MCESEV(
"Uncorrected no action required", SER), KEEP, "Uncorrected no action required",
MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_UC|MCI_STATUS_AR, PANIC, SER, MASK(MCI_UC_SAR, MCI_STATUS_UC)
"Illegal combination (UCNA with AR=1)", SER), ),
MASK(MCI_STATUS_S, 0, KEEP, "Non signalled machine check", SER), MCESEV(
PANIC, "Illegal combination (UCNA with AR=1)",
SER,
MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_UC|MCI_STATUS_AR)
),
MCESEV(
KEEP, "Non signalled machine check",
SER, BITCLR(MCI_STATUS_S)
),
/* AR add known MCACODs here */ /* AR add known MCACODs here */
MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_OVER|MCI_UC_SAR, PANIC, MCESEV(
"Action required with lost events", SER), PANIC, "Action required with lost events",
MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCACOD, MCI_UC_SAR, PANIC, SER, BITSET(MCI_STATUS_OVER|MCI_UC_SAR)
"Action required; unknown MCACOD", SER), ),
MCESEV(
PANIC, "Action required: unknown MCACOD",
SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_SAR)
),
/* known AO MCACODs: */ /* known AO MCACODs: */
MASK(MCI_UC_SAR|MCI_STATUS_OVER|0xfff0, MCI_UC_S|0xc0, AO, MCESEV(
"Action optional: memory scrubbing error", SER), AO, "Action optional: memory scrubbing error",
MASK(MCI_UC_SAR|MCI_STATUS_OVER|MCACOD, MCI_UC_S|0x17a, AO, SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|0xfff0, MCI_UC_S|0x00c0)
"Action optional: last level cache writeback error", SER), ),
MCESEV(
MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S, SOME, AO, "Action optional: last level cache writeback error",
"Action optional unknown MCACOD", SER), SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCACOD, MCI_UC_S|0x017a)
MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S|MCI_STATUS_OVER, SOME, ),
"Action optional with lost events", SER), MCESEV(
BITSET(MCI_STATUS_UC|MCI_STATUS_OVER, PANIC, "Overflowed uncorrected"), SOME, "Action optional: unknown MCACOD",
BITSET(MCI_STATUS_UC, UC, "Uncorrected"), SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S)
BITSET(0, SOME, "No match") /* always matches. keep at end */ ),
MCESEV(
SOME, "Action optional with lost events",
SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_OVER|MCI_UC_S)
),
MCESEV(
PANIC, "Overflowed uncorrected",
BITSET(MCI_STATUS_OVER|MCI_STATUS_UC)
),
MCESEV(
UC, "Uncorrected",
BITSET(MCI_STATUS_UC)
),
MCESEV(
SOME, "No match",
BITSET(0)
) /* always matches. keep at end */
}; };
/* /*
...@@ -112,15 +156,15 @@ static int error_context(struct mce *m) ...@@ -112,15 +156,15 @@ static int error_context(struct mce *m)
return IN_KERNEL; return IN_KERNEL;
} }
int mce_severity(struct mce *a, int tolerant, char **msg) int mce_severity(struct mce *m, int tolerant, char **msg)
{ {
enum context ctx = error_context(a); enum context ctx = error_context(m);
struct severity *s; struct severity *s;
for (s = severities;; s++) { for (s = severities;; s++) {
if ((a->status & s->mask) != s->result) if ((m->status & s->mask) != s->result)
continue; continue;
if ((a->mcgstatus & s->mcgmask) != s->mcgres) if ((m->mcgstatus & s->mcgmask) != s->mcgres)
continue; continue;
if (s->ser == SER_REQUIRED && !mce_ser) if (s->ser == SER_REQUIRED && !mce_ser)
continue; continue;
...@@ -197,15 +241,15 @@ static const struct file_operations severities_coverage_fops = { ...@@ -197,15 +241,15 @@ static const struct file_operations severities_coverage_fops = {
static int __init severities_debugfs_init(void) static int __init severities_debugfs_init(void)
{ {
struct dentry *dmce = NULL, *fseverities_coverage = NULL; struct dentry *dmce, *fsev;
dmce = mce_get_debugfs_dir(); dmce = mce_get_debugfs_dir();
if (dmce == NULL) if (!dmce)
goto err_out; goto err_out;
fseverities_coverage = debugfs_create_file("severities-coverage",
0444, dmce, NULL, fsev = debugfs_create_file("severities-coverage", 0444, dmce, NULL,
&severities_coverage_fops); &severities_coverage_fops);
if (fseverities_coverage == NULL) if (!fsev)
goto err_out; goto err_out;
return 0; return 0;
...@@ -214,4 +258,4 @@ static int __init severities_debugfs_init(void) ...@@ -214,4 +258,4 @@ static int __init severities_debugfs_init(void)
return -ENOMEM; return -ENOMEM;
} }
late_initcall(severities_debugfs_init); late_initcall(severities_debugfs_init);
#endif #endif /* CONFIG_DEBUG_FS */
This diff is collapsed.
...@@ -548,7 +548,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -548,7 +548,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
if (!b) if (!b)
goto out; goto out;
err = sysfs_create_link(&per_cpu(mce_dev, cpu).kobj, err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj,
b->kobj, name); b->kobj, name);
if (err) if (err)
goto out; goto out;
...@@ -571,7 +571,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -571,7 +571,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
goto out; goto out;
} }
b->kobj = kobject_create_and_add(name, &per_cpu(mce_dev, cpu).kobj); b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj);
if (!b->kobj) if (!b->kobj)
goto out_free; goto out_free;
...@@ -591,7 +591,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) ...@@ -591,7 +591,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
if (i == cpu) if (i == cpu)
continue; continue;
err = sysfs_create_link(&per_cpu(mce_dev, i).kobj, err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj,
b->kobj, name); b->kobj, name);
if (err) if (err)
goto out; goto out;
...@@ -669,7 +669,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -669,7 +669,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* sibling symlink */ /* sibling symlink */
if (shared_bank[bank] && b->blocks->cpu != cpu) { if (shared_bank[bank] && b->blocks->cpu != cpu) {
sysfs_remove_link(&per_cpu(mce_dev, cpu).kobj, name); sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name);
per_cpu(threshold_banks, cpu)[bank] = NULL; per_cpu(threshold_banks, cpu)[bank] = NULL;
return; return;
...@@ -681,7 +681,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -681,7 +681,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
if (i == cpu) if (i == cpu)
continue; continue;
sysfs_remove_link(&per_cpu(mce_dev, i).kobj, name); sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name);
per_cpu(threshold_banks, i)[bank] = NULL; per_cpu(threshold_banks, i)[bank] = NULL;
} }
......
...@@ -984,11 +984,6 @@ apicinterrupt THRESHOLD_APIC_VECTOR \ ...@@ -984,11 +984,6 @@ apicinterrupt THRESHOLD_APIC_VECTOR \
apicinterrupt THERMAL_APIC_VECTOR \ apicinterrupt THERMAL_APIC_VECTOR \
thermal_interrupt smp_thermal_interrupt thermal_interrupt smp_thermal_interrupt
#ifdef CONFIG_X86_MCE
apicinterrupt MCE_SELF_VECTOR \
mce_self_interrupt smp_mce_self_interrupt
#endif
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \ apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \
call_function_single_interrupt smp_call_function_single_interrupt call_function_single_interrupt smp_call_function_single_interrupt
......
...@@ -272,9 +272,6 @@ static void __init apic_intr_init(void) ...@@ -272,9 +272,6 @@ static void __init apic_intr_init(void)
#ifdef CONFIG_X86_MCE_THRESHOLD #ifdef CONFIG_X86_MCE_THRESHOLD
alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt); alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
#endif #endif
#if defined(CONFIG_X86_MCE) && defined(CONFIG_X86_LOCAL_APIC)
alloc_intr_gate(MCE_SELF_VECTOR, mce_self_interrupt);
#endif
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC)
/* self generated IPI for local APIC timer */ /* self generated IPI for local APIC timer */
......
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