diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck/mce-apei.c')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce-apei.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce-apei.c b/arch/x86/kernel/cpu/mcheck/mce-apei.c new file mode 100644 index 00000000000..4eccd1fadb1 --- /dev/null +++ b/arch/x86/kernel/cpu/mcheck/mce-apei.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Bridge between MCE and APEI | ||
3 | * | ||
4 | * On some machine, corrected memory errors are reported via APEI | ||
5 | * generic hardware error source (GHES) instead of corrected Machine | ||
6 | * Check. These corrected memory errors can be reported to user space | ||
7 | * through /dev/mcelog via faking a corrected Machine Check, so that | ||
8 | * the error memory page can be offlined by /sbin/mcelog if the error | ||
9 | * count for one page is beyond the threshold. | ||
10 | * | ||
11 | * Copyright 2010 Intel Corp. | ||
12 | * Author: Huang Ying <ying.huang@intel.com> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License version | ||
16 | * 2 as published by the Free Software Foundation. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
26 | */ | ||
27 | |||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/acpi.h> | ||
30 | #include <linux/cper.h> | ||
31 | #include <acpi/apei.h> | ||
32 | #include <asm/mce.h> | ||
33 | |||
34 | #include "mce-internal.h" | ||
35 | |||
36 | void apei_mce_report_mem_error(int corrected, struct cper_sec_mem_err *mem_err) | ||
37 | { | ||
38 | struct mce m; | ||
39 | |||
40 | /* Only corrected MC is reported */ | ||
41 | if (!corrected) | ||
42 | return; | ||
43 | |||
44 | mce_setup(&m); | ||
45 | m.bank = 1; | ||
46 | /* Fake a memory read corrected error with unknown channel */ | ||
47 | m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | 0x9f; | ||
48 | m.addr = mem_err->physical_addr; | ||
49 | mce_log(&m); | ||
50 | mce_notify_irq(); | ||
51 | } | ||
52 | EXPORT_SYMBOL_GPL(apei_mce_report_mem_error); | ||