diff options
| author | Borislav Petkov <borislav.petkov@amd.com> | 2010-09-02 12:33:24 -0400 |
|---|---|---|
| committer | Borislav Petkov <bp@amd64.org> | 2010-10-21 08:47:59 -0400 |
| commit | 9cdeb404a1870c5022915e576dbdc3cde21af5bf (patch) | |
| tree | 19843bf914f56f362a7c9cdf86c27a648caa475c | |
| parent | 30e1f7a8122145f44f45c95366e27b6bb0b08428 (diff) | |
EDAC, MCE: Rework MCE injection
Add sysfs injection facilities for testing of the MCE decoding code.
Remove large parts of amd64_edac_dbg.c, as a result, which did only
NB MCE injection anyway and the new injection code supports that
functionality already.
Add an injection module so that MCE decoding code in production kernels
like those in RHEL and SLES can be tested.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
| -rw-r--r-- | drivers/edac/Kconfig | 14 | ||||
| -rw-r--r-- | drivers/edac/Makefile | 2 | ||||
| -rw-r--r-- | drivers/edac/amd64_edac.h | 2 | ||||
| -rw-r--r-- | drivers/edac/amd64_edac_dbg.c | 213 | ||||
| -rw-r--r-- | drivers/edac/edac_mce_amd.c | 4 | ||||
| -rw-r--r-- | drivers/edac/edac_mce_amd.h | 4 | ||||
| -rw-r--r-- | drivers/edac/mce_amd_inj.c | 171 |
7 files changed, 203 insertions, 207 deletions
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig index 70bb350de996..3bb3a671baa0 100644 --- a/drivers/edac/Kconfig +++ b/drivers/edac/Kconfig | |||
| @@ -39,7 +39,7 @@ config EDAC_DEBUG | |||
| 39 | there're four debug levels (x=0,1,2,3 from low to high). | 39 | there're four debug levels (x=0,1,2,3 from low to high). |
| 40 | Usually you should select 'N'. | 40 | Usually you should select 'N'. |
| 41 | 41 | ||
| 42 | config EDAC_DECODE_MCE | 42 | config EDAC_DECODE_MCE |
| 43 | tristate "Decode MCEs in human-readable form (only on AMD for now)" | 43 | tristate "Decode MCEs in human-readable form (only on AMD for now)" |
| 44 | depends on CPU_SUP_AMD && X86_MCE | 44 | depends on CPU_SUP_AMD && X86_MCE |
| 45 | default y | 45 | default y |
| @@ -51,6 +51,16 @@ config EDAC_DEBUG | |||
| 51 | which occur really early upon boot, before the module infrastructure | 51 | which occur really early upon boot, before the module infrastructure |
| 52 | has been initialized. | 52 | has been initialized. |
| 53 | 53 | ||
| 54 | config EDAC_MCE_INJ | ||
| 55 | tristate "Simple MCE injection interface over /sysfs" | ||
| 56 | depends on EDAC_DECODE_MCE | ||
| 57 | default n | ||
| 58 | help | ||
| 59 | This is a simple interface to inject MCEs over /sysfs and test | ||
| 60 | the MCE decoding code in EDAC. | ||
| 61 | |||
| 62 | This is currently AMD-only. | ||
| 63 | |||
| 54 | config EDAC_MM_EDAC | 64 | config EDAC_MM_EDAC |
| 55 | tristate "Main Memory EDAC (Error Detection And Correction) reporting" | 65 | tristate "Main Memory EDAC (Error Detection And Correction) reporting" |
| 56 | help | 66 | help |
| @@ -72,7 +82,7 @@ config EDAC_AMD64 | |||
| 72 | Families of Memory Controllers (K8, F10h and F11h) | 82 | Families of Memory Controllers (K8, F10h and F11h) |
| 73 | 83 | ||
| 74 | config EDAC_AMD64_ERROR_INJECTION | 84 | config EDAC_AMD64_ERROR_INJECTION |
| 75 | bool "Sysfs Error Injection facilities" | 85 | bool "Sysfs HW Error injection facilities" |
| 76 | depends on EDAC_AMD64 | 86 | depends on EDAC_AMD64 |
| 77 | help | 87 | help |
| 78 | Recent Opterons (Family 10h and later) provide for Memory Error | 88 | Recent Opterons (Family 10h and later) provide for Memory Error |
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile index ca6b1bb24ccc..5c38ad38f3a3 100644 --- a/drivers/edac/Makefile +++ b/drivers/edac/Makefile | |||
| @@ -17,6 +17,8 @@ ifdef CONFIG_PCI | |||
| 17 | edac_core-objs += edac_pci.o edac_pci_sysfs.o | 17 | edac_core-objs += edac_pci.o edac_pci_sysfs.o |
| 18 | endif | 18 | endif |
| 19 | 19 | ||
| 20 | obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o | ||
| 21 | |||
| 20 | obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o | 22 | obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o |
| 21 | 23 | ||
| 22 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o | 24 | obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o |
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 613b9381e71a..67d9ceb4b839 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h | |||
| @@ -486,7 +486,7 @@ extern const char *ext_msgs[32]; | |||
| 486 | extern const char *htlink_msgs[8]; | 486 | extern const char *htlink_msgs[8]; |
| 487 | 487 | ||
| 488 | #ifdef CONFIG_EDAC_DEBUG | 488 | #ifdef CONFIG_EDAC_DEBUG |
| 489 | #define NUM_DBG_ATTRS 9 | 489 | #define NUM_DBG_ATTRS 5 |
| 490 | #else | 490 | #else |
| 491 | #define NUM_DBG_ATTRS 0 | 491 | #define NUM_DBG_ATTRS 0 |
| 492 | #endif | 492 | #endif |
diff --git a/drivers/edac/amd64_edac_dbg.c b/drivers/edac/amd64_edac_dbg.c index f6d5695de5b6..e3562288f4ce 100644 --- a/drivers/edac/amd64_edac_dbg.c +++ b/drivers/edac/amd64_edac_dbg.c | |||
| @@ -1,173 +1,16 @@ | |||
| 1 | #include "amd64_edac.h" | 1 | #include "amd64_edac.h" |
| 2 | 2 | ||
| 3 | /* | 3 | #define EDAC_DCT_ATTR_SHOW(reg) \ |
| 4 | * accept a hex value and store it into the virtual error register file, field: | 4 | static ssize_t amd64_##reg##_show(struct mem_ctl_info *mci, char *data) \ |
| 5 | * nbeal and nbeah. Assume virtual error values have already been set for: NBSL, | 5 | { \ |
| 6 | * NBSH and NBCFG. Then proceed to map the error values to a MC, CSROW and | 6 | struct amd64_pvt *pvt = mci->pvt_info; \ |
| 7 | * CHANNEL | 7 | return sprintf(data, "0x%016llx\n", (u64)pvt->reg); \ |
| 8 | */ | ||
| 9 | static ssize_t amd64_nbea_store(struct mem_ctl_info *mci, const char *data, | ||
| 10 | size_t count) | ||
| 11 | { | ||
| 12 | struct amd64_pvt *pvt = mci->pvt_info; | ||
| 13 | u64 value; | ||
| 14 | int ret = 0; | ||
| 15 | struct mce m; | ||
| 16 | |||
| 17 | ret = strict_strtoull(data, 16, &value); | ||
| 18 | if (ret != -EINVAL) { | ||
| 19 | struct err_regs *regs = &pvt->ctl_error_info; | ||
| 20 | |||
| 21 | debugf0("received NBEA= 0x%llx\n", value); | ||
| 22 | |||
| 23 | /* place the value into the virtual error packet */ | ||
| 24 | pvt->ctl_error_info.nbeal = (u32) value; | ||
| 25 | value >>= 32; | ||
| 26 | pvt->ctl_error_info.nbeah = (u32) value; | ||
| 27 | |||
| 28 | m.addr = value; | ||
| 29 | m.status = regs->nbsl | ((u64)regs->nbsh << 32); | ||
| 30 | |||
| 31 | /* Process the Mapping request */ | ||
| 32 | /* TODO: Add race prevention */ | ||
| 33 | amd_decode_nb_mce(pvt->mc_node_id, &m, regs->nbcfg); | ||
| 34 | |||
| 35 | return count; | ||
| 36 | } | ||
| 37 | return ret; | ||
| 38 | } | 8 | } |
| 39 | 9 | ||
| 40 | /* display back what the last NBEA (MCA NB Address (MC4_ADDR)) was written */ | 10 | EDAC_DCT_ATTR_SHOW(dhar); |
| 41 | static ssize_t amd64_nbea_show(struct mem_ctl_info *mci, char *data) | 11 | EDAC_DCT_ATTR_SHOW(dbam0); |
| 42 | { | 12 | EDAC_DCT_ATTR_SHOW(top_mem); |
| 43 | struct amd64_pvt *pvt = mci->pvt_info; | 13 | EDAC_DCT_ATTR_SHOW(top_mem2); |
| 44 | u64 value; | ||
| 45 | |||
| 46 | value = pvt->ctl_error_info.nbeah; | ||
| 47 | value <<= 32; | ||
| 48 | value |= pvt->ctl_error_info.nbeal; | ||
| 49 | |||
| 50 | return sprintf(data, "%llx\n", value); | ||
| 51 | } | ||
| 52 | |||
| 53 | /* store the NBSL (MCA NB Status Low (MC4_STATUS)) value user desires */ | ||
| 54 | static ssize_t amd64_nbsl_store(struct mem_ctl_info *mci, const char *data, | ||
| 55 | size_t count) | ||
| 56 | { | ||
| 57 | struct amd64_pvt *pvt = mci->pvt_info; | ||
| 58 | unsigned long value; | ||
| 59 | int ret = 0; | ||
| 60 | |||
| 61 | ret = strict_strtoul(data, 16, &value); | ||
| 62 | if (ret != -EINVAL) { | ||
| 63 | debugf0("received NBSL= 0x%lx\n", value); | ||
| 64 | |||
| 65 | pvt->ctl_error_info.nbsl = (u32) value; | ||
| 66 | |||
| 67 | return count; | ||
| 68 | } | ||
| 69 | return ret; | ||
| 70 | } | ||
| 71 | |||
| 72 | /* display back what the last NBSL value written */ | ||
| 73 | static ssize_t amd64_nbsl_show(struct mem_ctl_info *mci, char *data) | ||
| 74 | { | ||
| 75 | struct amd64_pvt *pvt = mci->pvt_info; | ||
| 76 | u32 value; | ||
| 77 | |||
| 78 | value = pvt->ctl_error_info.nbsl; | ||
| 79 | |||
| 80 | return sprintf(data, "%x\n", value); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* store the NBSH (MCA NB Status High) value user desires */ | ||
| 84 | static ssize_t amd64_nbsh_store(struct mem_ctl_info *mci, const char *data, | ||
| 85 | size_t count) | ||
| 86 | { | ||
| 87 | struct amd64_pvt *pvt = mci->pvt_info; | ||
| 88 | unsigned long value; | ||
| 89 | int ret = 0; | ||
| 90 | |||
| 91 | ret = strict_strtoul(data, 16, &value); | ||
| 92 | if (ret != -EINVAL) { | ||
| 93 | debugf0("received NBSH= 0x%lx\n", value); | ||
| 94 | |||
| 95 | pvt->ctl_error_info.nbsh = (u32) value; | ||
| 96 | |||
| 97 | return count; | ||
| 98 | } | ||
| 99 | return ret; | ||
| 100 | } | ||
| 101 | |||
| 102 | /* display back what the last NBSH value written */ | ||
| 103 | static ssize_t amd64_nbsh_show(struct mem_ctl_info *mci, char *data) | ||
| 104 | { | ||
| 105 | struct amd64_pvt *pvt = mci->pvt_info; | ||
| 106 | u32 value; | ||
| 107 | |||
