aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-27 12:06:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-27 12:06:43 -0400
commitde0b9d751b9cd4cfedd0112722e84d0b5abaac73 (patch)
tree060ed78592245d7f3af72dfe93a36c186b0b6ffe
parentfac3fcae3244d6d8af61f04d2c10b4fd5ee03933 (diff)
parentfc08a4703a418a398bbb575ac311d36d110ac786 (diff)
Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RAS fixes from Thomas Gleixner: "Two fixlets for RAS: - Export memory_error() so the NFIT module can utilize it - Handle memory errors in NFIT correctly" * 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: acpi, nfit: Fix the memory error check in nfit_handle_mce() x86/MCE: Export memory_error()
-rw-r--r--arch/x86/include/asm/mce.h1
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c13
-rw-r--r--drivers/acpi/nfit/mce.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 4fd5195deed0..3f9a3d2a5209 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -266,6 +266,7 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s
266#endif 266#endif
267 267
268int mce_available(struct cpuinfo_x86 *c); 268int mce_available(struct cpuinfo_x86 *c);
269bool mce_is_memory_error(struct mce *m);
269 270
270DECLARE_PER_CPU(unsigned, mce_exception_count); 271DECLARE_PER_CPU(unsigned, mce_exception_count);
271DECLARE_PER_CPU(unsigned, mce_poll_count); 272DECLARE_PER_CPU(unsigned, mce_poll_count);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5abd4bf73d6e..5cfbaeb6529a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -499,16 +499,14 @@ static int mce_usable_address(struct mce *m)
499 return 1; 499 return 1;
500} 500}
501 501
502static bool memory_error(struct mce *m) 502bool mce_is_memory_error(struct mce *m)
503{ 503{
504 struct cpuinfo_x86 *c = &boot_cpu_data; 504 if (m->cpuvendor == X86_VENDOR_AMD) {
505
506 if (c->x86_vendor == X86_VENDOR_AMD) {
507 /* ErrCodeExt[20:16] */ 505 /* ErrCodeExt[20:16] */
508 u8 xec = (m->status >> 16) & 0x1f; 506 u8 xec = (m->status >> 16) & 0x1f;
509 507
510 return (xec == 0x0 || xec == 0x8); 508 return (xec == 0x0 || xec == 0x8);
511 } else if (c->x86_vendor == X86_VENDOR_INTEL) { 509 } else if (m->cpuvendor == X86_VENDOR_INTEL) {
512 /* 510 /*
513 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes 511 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
514 * 512 *
@@ -529,6 +527,7 @@ static bool memory_error(struct mce *m)
529 527
530 return false; 528 return false;
531} 529}
530EXPORT_SYMBOL_GPL(mce_is_memory_error);
532 531
533static bool cec_add_mce(struct mce *m) 532static bool cec_add_mce(struct mce *m)
534{ 533{
@@ -536,7 +535,7 @@ static bool cec_add_mce(struct mce *m)
536 return false; 535 return false;
537 536
538 /* We eat only correctable DRAM errors with usable addresses. */ 537 /* We eat only correctable DRAM errors with usable addresses. */
539 if (memory_error(m) && 538 if (mce_is_memory_error(m) &&
540 !(m->status & MCI_STATUS_UC) && 539 !(m->status & MCI_STATUS_UC) &&
541 mce_usable_address(m)) 540 mce_usable_address(m))
542 if (!cec_add_elem(m->addr >> PAGE_SHIFT)) 541 if (!cec_add_elem(m->addr >> PAGE_SHIFT))
@@ -713,7 +712,7 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
713 712
714 severity = mce_severity(&m, mca_cfg.tolerant, NULL, false); 713 severity = mce_severity(&m, mca_cfg.tolerant, NULL, false);
715 714
716 if (severity == MCE_DEFERRED_SEVERITY && memory_error(&m)) 715 if (severity == MCE_DEFERRED_SEVERITY && mce_is_memory_error(&m))
717 if (m.status & MCI_STATUS_ADDRV) 716 if (m.status & MCI_STATUS_ADDRV)
718 m.severity = severity; 717 m.severity = severity;
719 718
diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
index 3ba1c3472cf9..fd86bec98dea 100644
--- a/drivers/acpi/nfit/mce.c
+++ b/drivers/acpi/nfit/mce.c
@@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
26 struct nfit_spa *nfit_spa; 26 struct nfit_spa *nfit_spa;
27 27
28 /* We only care about memory errors */ 28 /* We only care about memory errors */
29 if (!(mce->status & MCACOD)) 29 if (!mce_is_memory_error(mce))
30 return NOTIFY_DONE; 30 return NOTIFY_DONE;
31 31
32 /* 32 /*