x86 RAS: Reorganize functionality
Subsystems (3)
cover x86 RAS: Reorganize functionality
From: Borislav Petkov <[email protected]>
Hi all,
this is a first attempt at reorganizing and concentrating x86 RAS features under arch/x86/. The idea is to put them close to the MCA code so that code reuse and extending functionality can be done much more easily.
This first attempt deals only with AMD RAS features but I expect that we can put all into one unified menu entry in Kconfig after we've agreed on the structure.
As always, all comments are welcome.
Thanks.
PATCH 1/4 x86, mce: Enable MCA support by default
From: Borislav Petkov <[email protected]>
MCA is the most basic support for hardware error collection and reporting, and it is majorly unwise to run without it so enable machine check software support by default on x86.
--- arch/x86/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/Kconfig +1 -0
@@ -841,6 +841,7 @@ config X86_REROUTE_FOR_BROKEN_BOOT_IRQS config X86_MCE bool "Machine Check / overheating reporting" + default y ---help--- Machine Check support allows the processor to notify the kernel if it detects a problem (e.g. overheating, data corruption).
Signature · 1 line
1.7.4.rc2
PATCH 2/4 x86, RAS: Start reorganizing RAS features support
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Start relocating RAS features into a centralized location under arch/x86/kernel/cpu/ras/. Readjust Kconfig items and makefiles accordingly.
No functionality change.
---
arch/x86/Kconfig | 10 ++--------
arch/x86/include/asm/mce.h | 2 +-
arch/x86/kernel/cpu/Makefile | 2 +-
arch/x86/kernel/cpu/mcheck/Makefile | 1 -
arch/x86/kernel/cpu/ras/Kconfig | 16 ++++++++++++++++
arch/x86/kernel/cpu/ras/Makefile | 1 +
arch/x86/kernel/cpu/ras/amd/Makefile | 1 +
.../{mcheck/mce_amd.c => ras/amd/thresholding.c} | 0
8 files changed, 22 insertions(+), 11 deletions(-)
create mode 100644 arch/x86/kernel/cpu/ras/Kconfig
create mode 100644 arch/x86/kernel/cpu/ras/Makefile
create mode 100644 arch/x86/kernel/cpu/ras/amd/Makefile
rename arch/x86/kernel/cpu/{mcheck/mce_amd.c => ras/amd/thresholding.c} (100%)arch/x86/Kconfig +2 -8
@@ -856,13 +856,7 @@ config X86_MCE_INTEL Additional support for intel specific MCE features such as the thermal monitor. -config X86_MCE_AMD - def_bool y - prompt "AMD MCE features" - depends on X86_MCE && X86_LOCAL_APIC - ---help--- - Additional support for AMD specific MCE features such as - the DRAM Error Threshold. +source "arch/x86/kernel/cpu/ras/Kconfig" config X86_ANCIENT_MCE bool "Support for old Pentium 5 / WinChip machine checks"
@@ -873,7 +867,7 @@ config X86_ANCIENT_MCE line. config X86_MCE_THRESHOLD - depends on X86_MCE_AMD || X86_MCE_INTEL + depends on X86_AMD_ERROR_THRESHOLDING || X86_MCE_INTEL def_bool y config X86_MCE_INJECT
arch/x86/include/asm/mce.h +1 -1
@@ -174,7 +174,7 @@ static inline void cmci_rediscover(int dying) {}static inline void cmci_recheck (void ) {}#endif -#ifdef CONFIG_X86_MCE_AMD +#ifdef CONFIG_X86_AMD_ERROR_THRESHOLDING void mce_amd_feature_init (struct cpuinfo_x86 *c);#else static inline void mce_amd_feature_init (struct cpuinfo_x86 *c) { }
arch/x86/kernel/cpu/Makefile +1 -1
@@ -28,7 +28,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o -obj-$(CONFIG_X86_MCE) += mcheck/ +obj-$(CONFIG_X86_MCE) += mcheck/ ras/ obj-$(CONFIG_MTRR) += mtrr/ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
arch/x86/kernel/cpu/mcheck/Makefile +0 -1
@@ -2,7 +2,6 @@ obj-y = mce.o mce-severity.o obj-$(CONFIG_X86_ANCIENT_MCE) += winchip.o p5.o obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o -obj-$(CONFIG_X86_MCE_AMD) += mce_amd.o obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o
arch/x86/kernel/cpu/ras/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +menu "AMD RAS features" + depends on X86_MCE + +config X86_AMD_ERROR_THRESHOLDING + def_bool y + prompt "Error Thresholding" + depends on X86_LOCAL_APIC + ---help--- + Support hardware-maintained counters of some types of hw errors. + Currently, there three groups: DRAM, Link and L3 errors. For more + detailed information see the section on Error Thresholding in + the respective AMD BKDG. + +endmenu + +
arch/x86/kernel/cpu/ras/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_X86_MCE) += amd/
arch/x86/kernel/cpu/ras/amd/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_X86_AMD_ERROR_THRESHOLDING) += thresholding.o
arch/x86/kernel/cpu/ras/amd/thresholding.c renamed from arch/x86/kernel/cpu/mcheck/mce_amd.c +0 -0
Signature · 1 line
1.7.4.rc2
PATCH 3/4 x86, RAS: Move MCE decoding code into ras/
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
As part of collecting AMD RAS features at a single place, move the MCE decoding code there.
No functionality change.
--- .../x86/include/ras/amd/mce-decode.h | 0 arch/x86/kernel/cpu/ras/Kconfig | 14 +++++++++++++- arch/x86/kernel/cpu/ras/amd/Makefile | 3 +++ .../x86/kernel/cpu/ras/amd/mce-decode.c | 2 +- drivers/edac/Kconfig | 12 ------------ drivers/edac/Makefile | 3 --- drivers/edac/amd64_edac.h | 2 +- drivers/edac/mce_amd_inj.c | 3 +-- 8 files changed, 19 insertions(+), 20 deletions(-) rename drivers/edac/mce_amd.h => arch/x86/include/ras/amd/mce-decode.h (100%) rename drivers/edac/mce_amd.c => arch/x86/kernel/cpu/ras/amd/mce-decode.c (99%)
arch/x86/include/ras/amd/mce-decode.h renamed from drivers/edac/mce_amd.h +0 -0
arch/x86/kernel/cpu/ras/Kconfig +13 -1
@@ -1,5 +1,5 @@ menu "AMD RAS features" - depends on X86_MCE + depends on X86_MCE && CPU_SUP_AMD config X86_AMD_ERROR_THRESHOLDING def_bool y
@@ -11,6 +11,18 @@ config X86_AMD_ERROR_THRESHOLDING detailed information see the section on Error Thresholding in the respective AMD BKDG. +config X86_AMD_DECODE_MCE + tristate "Decode MCEs in human-readable form" + default y + ---help--- + Enable this option if you want to decode Machine Check Exceptions + occurring on your machine in a human-readable form. + + You should definitely say Y here in case you want to decode MCEs + which occur really early upon boot, before the module infrastructure + has been initialized. + + endmenu
arch/x86/kernel/cpu/ras/amd/Makefile +3 -0
@@ -1 +1,4 @@ obj-$(CONFIG_X86_AMD_ERROR_THRESHOLDING) += thresholding.o + +amd_mce_decode-y := mce-decode.o +obj-$(CONFIG_X86_AMD_DECODE_MCE) += amd_mce_decode.o
arch/x86/kernel/cpu/ras/amd/mce-decode.c renamed from drivers/edac/mce_amd.c +1 -1
@@ -1,7 +1,7 @@#include <linux/module.h> #include <linux/slab.h> -#include "mce_amd.h" +#include <ras/amd/mce-decode.h> static struct amd_decoder_ops *fam_ops;
drivers/edac/Kconfig +0 -12
@@ -39,18 +39,6 @@ config EDAC_DEBUG there're four debug levels (x=0,1,2,3 from low to high). Usually you should select 'N'. -config EDAC_DECODE_MCE - tristate "Decode MCEs in human-readable form (only on AMD for now)" - depends on CPU_SUP_AMD && X86_MCE - default y - ---help--- - Enable this option if you want to decode Machine Check Exceptions - occurring on your machine in human-readable form. - - You should definitely say Y here in case you want to decode MCEs - which occur really early upon boot, before the module infrastructure - has been initialized. - config EDAC_MCE_INJ tristate "Simple MCE injection interface over /sysfs" depends on EDAC_DECODE_MCE
drivers/edac/Makefile +0 -3
@@ -19,9 +19,6 @@ endif obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o -edac_mce_amd-y := mce_amd.o -obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o - obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.o
drivers/edac/amd64_edac.h +1 -1
@@ -71,8 +71,8 @@#include <linux/mmzone.h> #include <linux/edac.h> #include <asm/msr.h> +#include <ras/amd/mce-decode.h> #include "edac_core.h" -#include "mce_amd.h" #define amd64_debug(fmt, arg...) \ edac_printk(KERN_DEBUG, "amd64", fmt, ##arg)
drivers/edac/mce_amd_inj.c +1 -2
@@ -14,8 +14,7 @@#include <linux/sysdev.h> #include <linux/edac.h> #include <asm/mce.h> - -#include "mce_amd.h" +#include <ras/amd/mce-decode.h> struct edac_mce_attr {struct attribute attr;
Signature · 1 line
1.7.4.rc2
PATCH 4/4 x86, RAS: Move MCE injection code into ras/
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
This is the code collecting all AMD MCE injection methods.
No functionality change.
--- arch/x86/kernel/cpu/ras/Kconfig | 9 +++++++-- arch/x86/kernel/cpu/ras/amd/Makefile | 3 +++ .../x86/kernel/cpu/ras/amd/mce-inject.c | 0 drivers/edac/Kconfig | 10 ---------- drivers/edac/Makefile | 2 -- 5 files changed, 10 insertions(+), 14 deletions(-) rename drivers/edac/mce_amd_inj.c => arch/x86/kernel/cpu/ras/amd/mce-inject.c (100%)
arch/x86/kernel/cpu/ras/Kconfig +7 -2
@@ -22,7 +22,12 @@ config X86_AMD_DECODE_MCE which occur really early upon boot, before the module infrastructure has been initialized. +config X86_AMD_MCE_INJECT + tristate "Simple MCE injection interface over /sysfs" + depends on X86_AMD_DECODE_MCE + default n + help + This is a simple interface to inject MCEs over /sysfs and test + the MCE decoding code. endmenu - -
arch/x86/kernel/cpu/ras/amd/Makefile +3 -0
@@ -2,3 +2,6 @@ obj-$(CONFIG_X86_AMD_ERROR_THRESHOLDING) += thresholding.o amd_mce_decode-y := mce-decode.o obj-$(CONFIG_X86_AMD_DECODE_MCE) += amd_mce_decode.o + +amd_mce_inject-y := mce-inject.o +obj-$(CONFIG_X86_AMD_MCE_INJECT) += amd_mce_inject.o
arch/x86/kernel/cpu/ras/amd/mce-inject.c renamed from drivers/edac/mce_amd_inj.c +0 -0
drivers/edac/Kconfig +0 -10
@@ -39,16 +39,6 @@ config EDAC_DEBUG there're four debug levels (x=0,1,2,3 from low to high). Usually you should select 'N'. -config EDAC_MCE_INJ - tristate "Simple MCE injection interface over /sysfs" - depends on EDAC_DECODE_MCE - default n - help - This is a simple interface to inject MCEs over /sysfs and test - the MCE decoding code in EDAC. - - This is currently AMD-only. - config EDAC_MM_EDAC tristate "Main Memory EDAC (Error Detection And Correction) reporting" help
drivers/edac/Makefile +0 -2
@@ -17,8 +17,6 @@ ifdef CONFIG_PCI edac_core-y += edac_pci.o edac_pci_sysfs.o endif -obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o - obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.o
Signature · 1 line
1.7.4.rc2