diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2009-10-02 09:31:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-02 09:42:19 -0400 |
commit | 0d18b2e34bd1ad8f5bd3f3a17b5e7df132e511a9 (patch) | |
tree | ec8968797976e386245fb383a5cee800b6b75140 /drivers/edac | |
parent | 329bd4119c8a0afea95f9db6d6b402a2f2b40e84 (diff) |
x86: EDAC: carve out AMD MCE decoding logic
This converts the MCE decoding logic into a standalone config
option which can be built-in or a module, the first one being the
default for MCEs happening early on in the boot process.
This, beyond being separated in a cleaner way, also saves RAM by
making the decoding logic modular.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>
LKML-Reference: <20091002133148.GD28682@aftab>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/Kconfig | 14 | ||||
-rw-r--r-- | drivers/edac/Makefile | 5 | ||||
-rw-r--r-- | drivers/edac/edac_mce_amd.c | 19 |
3 files changed, 32 insertions, 6 deletions
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index 02127e59fe8e..55c9c59b3f71 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig | |||
@@ -47,6 +47,18 @@ config EDAC_DEBUG_VERBOSE | |||
47 | Source file name and line number where debugging message | 47 | Source file name and line number where debugging message |
48 | printed will be added to debugging message. | 48 | printed will be added to debugging message. |
49 | 49 | ||
50 | config EDAC_DECODE_MCE | ||
51 | tristate "Decode MCEs in human-readable form (only on AMD for now)" | ||
52 | depends on CPU_SUP_AMD && X86_MCE | ||
53 | default y | ||
54 | ---help--- | ||
55 | Enable this option if you want to decode Machine Check Exceptions | ||
56 | occuring on your machine in human-readable form. | ||
57 | |||
58 | You should definitely say Y here in case you want to decode MCEs | ||
59 | which occur really early upon boot, before the module infrastructure | ||
60 | has been initialized. | ||
61 | |||
50 | config EDAC_MM_EDAC | 62 | config EDAC_MM_EDAC |
51 | tristate "Main Memory EDAC (Error Detection And Correction) reporting" | 63 | tristate "Main Memory EDAC (Error Detection And Correction) reporting" |
52 | help | 64 | help |
@@ -59,7 +71,7 @@ config EDAC_MM_EDAC | |||
59 | 71 | ||
60 | config EDAC_AMD64 | 72 | config EDAC_AMD64 |
61 | tristate "AMD64 (Opteron, Athlon64) K8, F10h, F11h" | 73 | tristate "AMD64 (Opteron, Athlon64) K8, F10h, F11h" |
62 | depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && CPU_SUP_AMD | 74 | depends on EDAC_MM_EDAC && K8_NB && X86_64 && PCI && EDAC_DECODE_MCE |
63 | help | 75 | help |
64 | Support for error detection and correction on the AMD 64 | 76 | Support for error detection and correction on the AMD 64 |
65 | Families of Memory Controllers (K8, F10h and F11h) | 77 | Families of Memory Controllers (K8, F10h and F11h) |
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index 8701cd7ce4e3..bc5dc232a0fb 100644 --- a/drivers/edac/Makefile +++ b/drivers/edac/Makefile | |||
@@ -6,7 +6,6 @@ | |||
6 | # GNU General Public License. | 6 | # GNU General Public License. |
7 | # | 7 | # |
8 | 8 | ||
9 | |||
10 | obj-$(CONFIG_EDAC) := edac_stub.o | 9 | obj-$(CONFIG_EDAC) := edac_stub.o |
11 | obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o | 10 | obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o |
12 | 11 | ||
@@ -17,9 +16,7 @@ ifdef CONFIG_PCI | |||
17 | edac_core-objs += edac_pci.o edac_pci_sysfs.o | 16 | edac_core-objs += edac_pci.o edac_pci_sysfs.o |
18 | endif | 17 | endif |
19 | 18 | ||
20 | ifdef CONFIG_CPU_SUP_AMD | 19 | obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o |
21 | obj-$(CONFIG_X86_MCE) += edac_mce_amd.o | ||
22 | endif | ||
23 | 20 | ||
24 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o | 21 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o |
25 | obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o | 22 | obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o |
diff --git a/drivers/edac/edac_mce_amd.c b/drivers/edac/edac_mce_amd.c index 83a01a1187d7..713ed7d37247 100644 --- a/drivers/edac/edac_mce_amd.c +++ b/drivers/edac/edac_mce_amd.c | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | static bool report_gart_errors; | 4 | static bool report_gart_errors; |
5 | static void (*nb_bus_decoder)(int node_id, struct err_regs *regs); | 5 | static void (*nb_bus_decoder)(int node_id, struct err_regs *regs); |
6 | static void (*orig_mce_callback)(struct mce *m); | ||
6 | 7 | ||
7 | void amd_report_gart_errors(bool v) | 8 | void amd_report_gart_errors(bool v) |
8 | { | 9 | { |
@@ -427,9 +428,25 @@ static int __init mce_amd_init(void) | |||
427 | * We can decode MCEs for Opteron and later CPUs: | 428 | * We can decode MCEs for Opteron and later CPUs: |
428 | */ | 429 | */ |
429 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && | 430 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && |
430 | (boot_cpu_data.x86 >= 0xf)) | 431 | (boot_cpu_data.x86 >= 0xf)) { |
432 | /* safe the default decode mce callback */ | ||
433 | orig_mce_callback = x86_mce_decode_callback; | ||
434 | |||
431 | x86_mce_decode_callback = amd_decode_mce; | 435 | x86_mce_decode_callback = amd_decode_mce; |
436 | } | ||
432 | 437 | ||
433 | return 0; | 438 | return 0; |
434 | } | 439 | } |
435 | early_initcall(mce_amd_init); | 440 | early_initcall(mce_amd_init); |
441 | |||
442 | #ifdef MODULE | ||
443 | static void __exit mce_amd_exit(void) | ||
444 | { | ||
445 | x86_mce_decode_callback = orig_mce_callback; | ||
446 | } | ||
447 | |||
448 | MODULE_DESCRIPTION("AMD MCE decoder"); | ||
449 | MODULE_ALIAS("edac-mce-amd"); | ||
450 | MODULE_LICENSE("GPL"); | ||
451 | module_exit(mce_amd_exit); | ||
452 | #endif | ||