2 * Non Fatal Machine Check Exception Reporting
4 * (C) Copyright 2002 Dave Jones. <davej@codemonkey.org.uk>
6 * This file contains routines to check for non-fatal MCEs every 15s
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/jiffies.h>
14 #include <linux/workqueue.h>
15 #include <linux/interrupt.h>
16 #include <linux/smp.h>
17 #include <linux/module.h>
19 #include <asm/processor.h>
20 #include <asm/system.h>
27 #define MCE_RATE 15*HZ /* timer rate is 15s */
29 static void mce_checkregs (void *info
)
34 for (i
=firstbank
; i
<nr_mce_banks
; i
++) {
35 rdmsr (MSR_IA32_MC0_STATUS
+i
*4, low
, high
);
38 printk(KERN_INFO
"MCE: The hardware reports a non "
39 "fatal, correctable incident occurred on "
42 printk (KERN_INFO
"Bank %d: %08x%08x\n", i
, high
, low
);
44 /* Scrub the error so we don't pick it up in MCE_RATE seconds time. */
45 wrmsr (MSR_IA32_MC0_STATUS
+i
*4, 0UL, 0UL);
49 add_taint(TAINT_MACHINE_CHECK
);
54 static void mce_work_fn(struct work_struct
*work
);
55 static DECLARE_DELAYED_WORK(mce_work
, mce_work_fn
);
57 static void mce_work_fn(struct work_struct
*work
)
59 on_each_cpu(mce_checkregs
, NULL
, 1, 1);
60 schedule_delayed_work(&mce_work
, round_jiffies_relative(MCE_RATE
));
63 static int __init
init_nonfatal_mce_checker(void)
65 struct cpuinfo_x86
*c
= &boot_cpu_data
;
67 /* Check for MCE support */
68 if (!cpu_has(c
, X86_FEATURE_MCE
))
71 /* Check for PPro style MCA */
72 if (!cpu_has(c
, X86_FEATURE_MCA
))
75 /* Some Athlons misbehave when we frob bank 0 */
76 if (boot_cpu_data
.x86_vendor
== X86_VENDOR_AMD
&&
77 boot_cpu_data
.x86
== 6)
83 * Check for non-fatal errors every MCE_RATE s
85 schedule_delayed_work(&mce_work
, round_jiffies_relative(MCE_RATE
));
86 printk(KERN_INFO
"Machine check exception polling timer started.\n");
89 module_init(init_nonfatal_mce_checker
);
91 MODULE_LICENSE("GPL");