Commit de0b9d75 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents fac3fcae fc08a470
...@@ -266,6 +266,7 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s ...@@ -266,6 +266,7 @@ static inline int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *s
#endif #endif
int mce_available(struct cpuinfo_x86 *c); int mce_available(struct cpuinfo_x86 *c);
bool mce_is_memory_error(struct mce *m);
DECLARE_PER_CPU(unsigned, mce_exception_count); DECLARE_PER_CPU(unsigned, mce_exception_count);
DECLARE_PER_CPU(unsigned, mce_poll_count); DECLARE_PER_CPU(unsigned, mce_poll_count);
......
...@@ -499,16 +499,14 @@ static int mce_usable_address(struct mce *m) ...@@ -499,16 +499,14 @@ static int mce_usable_address(struct mce *m)
return 1; return 1;
} }
static bool memory_error(struct mce *m) bool mce_is_memory_error(struct mce *m)
{ {
struct cpuinfo_x86 *c = &boot_cpu_data; if (m->cpuvendor == X86_VENDOR_AMD) {
if (c->x86_vendor == X86_VENDOR_AMD) {
/* ErrCodeExt[20:16] */ /* ErrCodeExt[20:16] */
u8 xec = (m->status >> 16) & 0x1f; u8 xec = (m->status >> 16) & 0x1f;
return (xec == 0x0 || xec == 0x8); return (xec == 0x0 || xec == 0x8);
} else if (c->x86_vendor == X86_VENDOR_INTEL) { } else if (m->cpuvendor == X86_VENDOR_INTEL) {
/* /*
* Intel SDM Volume 3B - 15.9.2 Compound Error Codes * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
* *
...@@ -529,6 +527,7 @@ static bool memory_error(struct mce *m) ...@@ -529,6 +527,7 @@ static bool memory_error(struct mce *m)
return false; return false;
} }
EXPORT_SYMBOL_GPL(mce_is_memory_error);
static bool cec_add_mce(struct mce *m) static bool cec_add_mce(struct mce *m)
{ {
...@@ -536,7 +535,7 @@ static bool cec_add_mce(struct mce *m) ...@@ -536,7 +535,7 @@ static bool cec_add_mce(struct mce *m)
return false; return false;
/* We eat only correctable DRAM errors with usable addresses. */ /* We eat only correctable DRAM errors with usable addresses. */
if (memory_error(m) && if (mce_is_memory_error(m) &&
!(m->status & MCI_STATUS_UC) && !(m->status & MCI_STATUS_UC) &&
mce_usable_address(m)) mce_usable_address(m))
if (!cec_add_elem(m->addr >> PAGE_SHIFT)) 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,7 +712,7 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
severity = mce_severity(&m, mca_cfg.tolerant, NULL, false); severity = mce_severity(&m, mca_cfg.tolerant, NULL, false);
if (severity == MCE_DEFERRED_SEVERITY && memory_error(&m)) if (severity == MCE_DEFERRED_SEVERITY && mce_is_memory_error(&m))
if (m.status & MCI_STATUS_ADDRV) if (m.status & MCI_STATUS_ADDRV)
m.severity = severity; m.severity = severity;
......
...@@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, ...@@ -26,7 +26,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
struct nfit_spa *nfit_spa; struct nfit_spa *nfit_spa;
/* We only care about memory errors */ /* We only care about memory errors */
if (!(mce->status & MCACOD)) if (!mce_is_memory_error(mce))
return NOTIFY_DONE; return NOTIFY_DONE;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment