summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/cpu/mcheck/non-fatal.c')
-rw-r--r--arch/i386/kernel/cpu/mcheck/non-fatal.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/i386/kernel/cpu/mcheck/non-fatal.c b/arch/i386/kernel/cpu/mcheck/non-fatal.c
new file mode 100644
index 000000000000..7864ddfccf07
--- /dev/null
+++ b/arch/i386/kernel/cpu/mcheck/non-fatal.c
@@ -0,0 +1,93 @@
1/*
2 * Non Fatal Machine Check Exception Reporting
3 *
4 * (C) Copyright 2002 Dave Jones. <davej@codemonkey.org.uk>
5 *
6 * This file contains routines to check for non-fatal MCEs every 15s
7 *
8 */
9
10#include <linux/init.h>
11#include <linux/types.h>
12#include <linux/kernel.h>
13#include <linux/jiffies.h>
14#include <linux/config.h>
15#include <linux/irq.h>
16#include <linux/workqueue.h>
17#include <linux/interrupt.h>
18#include <linux/smp.h>
19#include <linux/module.h>
20
21#include <asm/processor.h>
22#include <asm/system.h>
23#include <asm/msr.h>
24
25#include "mce.h"
26
27static int firstbank;
28
29#define MCE_RATE 15*HZ /* timer rate is 15s */
30
31static void mce_checkregs (void *info)
32{
33 u32 low, high;
34 int i;
35
36 for (i=firstbank; i<nr_mce_banks; i++) {
37 rdmsr (MSR_IA32_MC0_STATUS+i*4, low, high);
38
39 if (high & (1<<31)) {
40 printk(KERN_INFO "MCE: The hardware reports a non "
41 "fatal, correctable incident occurred on "
42 "CPU %d.\n",
43 smp_processor_id());
44 printk (KERN_INFO "Bank %d: %08x%08x\n", i, high, low);
45
46 /* Scrub the error so we don't pick it up in MCE_RATE seconds time. */
47 wrmsr (MSR_IA32_MC0_STATUS+i*4, 0UL, 0UL);
48
49 /* Serialize */
50 wmb();
51 add_taint(TAINT_MACHINE_CHECK);
52 }
53 }
54}
55
56static void mce_work_fn(void *data);
57static DECLARE_WORK(mce_work, mce_work_fn, NULL);
58
59static void mce_work_fn(void *data)
60{
61 on_each_cpu(mce_checkregs, NULL, 1, 1);
62 schedule_delayed_work(&mce_work, MCE_RATE);
63}
64
65static int __init init_nonfatal_mce_checker(void)
66{
67 struct cpuinfo_x86 *c = &boot_cpu_data;
68
69 /* Check for MCE support */
70 if (!cpu_has(c, X86_FEATURE_MCE))
71 return -ENODEV;
72
73 /* Check for PPro style MCA */
74 if (!cpu_has(c, X86_FEATURE_MCA))
75 return -ENODEV;
76
77 /* Some Athlons misbehave when we frob bank 0 */
78 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
79 boot_cpu_data.x86 == 6)
80 firstbank = 1;
81 else
82 firstbank = 0;
83
84 /*
85 * Check for non-fatal errors every MCE_RATE s
86 */
87 schedule_delayed_work(&mce_work, MCE_RATE);
88 printk(KERN_INFO "Machine check exception polling timer started.\n");
89 return 0;
90}
91module_init(init_nonfatal_mce_checker);
92
93MODULE_LICENSE("GPL");