Commit 89d1cf89 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'edac_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp

Pull EDAC updates from Borislav Petkov:

 - an EDAC driver for Cavium ThunderX RAS IP (Sergey Temerkhanov)

 - removal of DRAM error reporting through PCI SERR NMI (Borislav
   Petkov)

 - misc small fixes (Jan Glauber, Thor Thayer)

* tag 'edac_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp:
  EDAC, ghes: Do not enable it by default
  EDAC: Rename report status accessors
  EDAC: Delete edac_stub.c
  EDAC: Update Kconfig help text
  EDAC: Remove EDAC_MM_EDAC
  EDAC: Issue tracepoint only when it is defined
  ACPI/extlog: Add EDAC dependency
  EDAC: Move edac_op_state to edac_mc.c
  EDAC: Remove edac_err_assert
  EDAC: Get rid of edac_handlers
  x86/nmi, EDAC: Get rid of DRAM error reporting thru PCI SERR NMI
  EDAC, highbank: Align Makefile directives
  EDAC, thunderx: Remove unused code
  EDAC, thunderx: Change LMC index calculation
  EDAC, altera: Fix peripheral warnings for Cyclone5
  EDAC, thunderx: Fix L2C MCI interrupt disable
  EDAC, thunderx: Add Cavium ThunderX EDAC driver
parents 08c521a2 f8d5549d
...@@ -4715,6 +4715,7 @@ L: linux-edac@vger.kernel.org ...@@ -4715,6 +4715,7 @@ L: linux-edac@vger.kernel.org
L: linux-mips@linux-mips.org L: linux-mips@linux-mips.org
S: Supported S: Supported
F: drivers/edac/octeon_edac* F: drivers/edac/octeon_edac*
F: drivers/edac/thunderx_edac*
EDAC-E752X EDAC-E752X
M: Mark Gross <mark.gross@intel.com> M: Mark Gross <mark.gross@intel.com>
......
...@@ -748,7 +748,6 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ...@@ -748,7 +748,6 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_TRANSIENT=y CONFIG_LEDS_TRIGGER_TRANSIENT=y
CONFIG_LEDS_TRIGGER_CAMERA=y CONFIG_LEDS_TRIGGER_CAMERA=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_HIGHBANK_MC=y CONFIG_EDAC_HIGHBANK_MC=y
CONFIG_EDAC_HIGHBANK_L2=y CONFIG_EDAC_HIGHBANK_L2=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
......
...@@ -635,8 +635,7 @@ CONFIG_LEDS_TRIGGER_GPIO=m ...@@ -635,8 +635,7 @@ CONFIG_LEDS_TRIGGER_GPIO=m
CONFIG_LEDS_TRIGGER_DEFAULT_ON=m CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
CONFIG_LEDS_TRIGGER_TRANSIENT=m CONFIG_LEDS_TRIGGER_TRANSIENT=m
CONFIG_LEDS_TRIGGER_CAMERA=m CONFIG_LEDS_TRIGGER_CAMERA=m
CONFIG_EDAC=y CONFIG_EDAC=m
CONFIG_EDAC_MM_EDAC=m
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DEBUG=y CONFIG_RTC_DEBUG=y
CONFIG_RTC_DRV_DS1307=m CONFIG_RTC_DRV_DS1307=m
......
...@@ -16,9 +16,8 @@ CONFIG_DAVICOM_PHY=y ...@@ -16,9 +16,8 @@ CONFIG_DAVICOM_PHY=y
CONFIG_DMADEVICES=y CONFIG_DMADEVICES=y
CONFIG_E1000E=y CONFIG_E1000E=y
CONFIG_E1000=y CONFIG_E1000=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_MPC85XX=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MPC85XX=y
CONFIG_EEPROM_AT24=y CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_LEGACY=y CONFIG_EEPROM_LEGACY=y
CONFIG_FB_FSL_DIU=y CONFIG_FB_FSL_DIU=y
......
...@@ -155,7 +155,6 @@ CONFIG_USB_OHCI_HCD_PPC_OF_BE=y ...@@ -155,7 +155,6 @@ CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
CONFIG_USB_OHCI_HCD_PPC_OF_LE=y CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_MPC85XX=y CONFIG_EDAC_MPC85XX=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
# CONFIG_RTC_INTF_PROC is not set # CONFIG_RTC_INTF_PROC is not set
......
...@@ -116,7 +116,6 @@ CONFIG_LEDS_TRIGGERS=y ...@@ -116,7 +116,6 @@ CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307=y
CONFIG_RTC_DRV_CMOS=y CONFIG_RTC_DRV_CMOS=y
......
...@@ -179,7 +179,6 @@ CONFIG_INFINIBAND_MTHCA=m ...@@ -179,7 +179,6 @@ CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_IPOIB=m CONFIG_INFINIBAND_IPOIB=m
CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_CELL=y CONFIG_EDAC_CELL=y
CONFIG_UIO=m CONFIG_UIO=m
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
......
...@@ -142,7 +142,6 @@ CONFIG_USB_UHCI_HCD=y ...@@ -142,7 +142,6 @@ CONFIG_USB_UHCI_HCD=y
CONFIG_USB_SL811_HCD=y CONFIG_USB_SL811_HCD=y
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_PASEMI=y CONFIG_EDAC_PASEMI=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307=y
......
...@@ -262,7 +262,6 @@ CONFIG_INFINIBAND_IPOIB_CM=y ...@@ -262,7 +262,6 @@ CONFIG_INFINIBAND_IPOIB_CM=y
CONFIG_INFINIBAND_SRP=m CONFIG_INFINIBAND_SRP=m
CONFIG_INFINIBAND_ISER=m CONFIG_INFINIBAND_ISER=m
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_PASEMI=y CONFIG_EDAC_PASEMI=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307=y
......
...@@ -173,7 +173,6 @@ CONFIG_INFINIBAND_MTHCA=m ...@@ -173,7 +173,6 @@ CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_IPOIB=m CONFIG_INFINIBAND_IPOIB=m
CONFIG_INFINIBAND_ISER=m CONFIG_INFINIBAND_ISER=m
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307=y
CONFIG_FS_DAX=y CONFIG_FS_DAX=y
......
...@@ -988,8 +988,7 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=m ...@@ -988,8 +988,7 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=m
CONFIG_LEDS_TRIGGER_DEFAULT_ON=m CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
CONFIG_ACCESSIBILITY=y CONFIG_ACCESSIBILITY=y
CONFIG_A11Y_BRAILLE_CONSOLE=y CONFIG_A11Y_BRAILLE_CONSOLE=y
CONFIG_EDAC=y CONFIG_EDAC=m
CONFIG_EDAC_MM_EDAC=m
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set # CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_DRV_DS1307=m CONFIG_RTC_DRV_DS1307=m
......
...@@ -249,7 +249,6 @@ CONFIG_USB_EHCI_HCD=y ...@@ -249,7 +249,6 @@ CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_HCD=y
CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE=y
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_TILE=y CONFIG_RTC_DRV_TILE=y
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
......
...@@ -358,7 +358,6 @@ CONFIG_WATCHDOG_NOWAYOUT=y ...@@ -358,7 +358,6 @@ CONFIG_WATCHDOG_NOWAYOUT=y
# CONFIG_VGA_ARB is not set # CONFIG_VGA_ARB is not set
# CONFIG_USB_SUPPORT is not set # CONFIG_USB_SUPPORT is not set
CONFIG_EDAC=y CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_TILE=y CONFIG_RTC_DRV_TILE=y
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
......
...@@ -222,17 +222,6 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs) ...@@ -222,17 +222,6 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs)
pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n", pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
reason, smp_processor_id()); reason, smp_processor_id());
/*
* On some machines, PCI SERR line is used to report memory
* errors. EDAC makes use of it.
*/
#if defined(CONFIG_EDAC)
if (edac_handler_set()) {
edac_atomic_assert_error();
return;
}
#endif
if (panic_on_unrecovered_nmi) if (panic_on_unrecovered_nmi)
nmi_panic(regs, "NMI: Not continuing"); nmi_panic(regs, "NMI: Not continuing");
......
...@@ -469,9 +469,8 @@ config ACPI_WATCHDOG ...@@ -469,9 +469,8 @@ config ACPI_WATCHDOG
config ACPI_EXTLOG config ACPI_EXTLOG
tristate "Extended Error Log support" tristate "Extended Error Log support"
depends on X86_MCE && X86_LOCAL_APIC depends on X86_MCE && X86_LOCAL_APIC && EDAC
select UEFI_CPER select UEFI_CPER
select RAS
default n default n
help help
Certain usages such as Predictive Failure Analysis (PFA) require Certain usages such as Predictive Failure Analysis (PFA) require
......
...@@ -229,7 +229,7 @@ static int __init extlog_init(void) ...@@ -229,7 +229,7 @@ static int __init extlog_init(void)
if (!(cap & MCG_ELOG_P) || !extlog_get_l1addr()) if (!(cap & MCG_ELOG_P) || !extlog_get_l1addr())
return -ENODEV; return -ENODEV;
if (get_edac_report_status() == EDAC_REPORTING_FORCE) { if (edac_get_report_status() == EDAC_REPORTING_FORCE) {
pr_warn("Not loading eMCA, error reporting force-enabled through EDAC.\n"); pr_warn("Not loading eMCA, error reporting force-enabled through EDAC.\n");
return -EPERM; return -EPERM;
} }
...@@ -285,8 +285,8 @@ static int __init extlog_init(void) ...@@ -285,8 +285,8 @@ static int __init extlog_init(void)
* eMCA event report method has higher priority than EDAC method, * eMCA event report method has higher priority than EDAC method,
* unless EDAC event report method is mandatory. * unless EDAC event report method is mandatory.
*/ */
old_edac_report_status = get_edac_report_status(); old_edac_report_status = edac_get_report_status();
set_edac_report_status(EDAC_REPORTING_DISABLED); edac_set_report_status(EDAC_REPORTING_DISABLED);
mce_register_decode_chain(&extlog_mce_dec); mce_register_decode_chain(&extlog_mce_dec);
/* enable OS to be involved to take over management from BIOS */ /* enable OS to be involved to take over management from BIOS */
((struct extlog_l1_head *)extlog_l1_addr)->flags |= FLAG_OS_OPTIN; ((struct extlog_l1_head *)extlog_l1_addr)->flags |= FLAG_OS_OPTIN;
...@@ -308,7 +308,7 @@ static int __init extlog_init(void) ...@@ -308,7 +308,7 @@ static int __init extlog_init(void)
static void __exit extlog_exit(void) static void __exit extlog_exit(void)
{ {
set_edac_report_status(old_edac_report_status); edac_set_report_status(old_edac_report_status);
mce_unregister_decode_chain(&extlog_mce_dec); mce_unregister_decode_chain(&extlog_mce_dec);
((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN; ((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
if (extlog_l1_addr) if (extlog_l1_addr)
......
This diff is collapsed.
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
# GNU General Public License. # GNU General Public License.
# #
obj-$(CONFIG_EDAC) := edac_stub.o obj-$(CONFIG_EDAC) := edac_core.o
obj-$(CONFIG_EDAC_MM_EDAC) += edac_core.o
edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o edac_core-y := edac_mc.o edac_device.o edac_mc_sysfs.o
edac_core-y += edac_module.o edac_device_sysfs.o wq.o edac_core-y += edac_module.o edac_device_sysfs.o wq.o
...@@ -74,6 +73,7 @@ obj-$(CONFIG_EDAC_OCTEON_PC) += octeon_edac-pc.o ...@@ -74,6 +73,7 @@ obj-$(CONFIG_EDAC_OCTEON_PC) += octeon_edac-pc.o
obj-$(CONFIG_EDAC_OCTEON_L2C) += octeon_edac-l2c.o obj-$(CONFIG_EDAC_OCTEON_L2C) += octeon_edac-l2c.o
obj-$(CONFIG_EDAC_OCTEON_LMC) += octeon_edac-lmc.o obj-$(CONFIG_EDAC_OCTEON_LMC) += octeon_edac-lmc.o
obj-$(CONFIG_EDAC_OCTEON_PCI) += octeon_edac-pci.o obj-$(CONFIG_EDAC_OCTEON_PCI) += octeon_edac-pci.o
obj-$(CONFIG_EDAC_THUNDERX) += thunderx_edac.o
obj-$(CONFIG_EDAC_ALTERA) += altera_edac.o obj-$(CONFIG_EDAC_ALTERA) += altera_edac.o
obj-$(CONFIG_EDAC_SYNOPSYS) += synopsys_edac.o obj-$(CONFIG_EDAC_SYNOPSYS) += synopsys_edac.o
......
...@@ -1023,12 +1023,22 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, ...@@ -1023,12 +1023,22 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask,
return ret; return ret;
} }
static int socfpga_is_a10(void)
{
return of_machine_is_compatible("altr,socfpga-arria10");
}
static int validate_parent_available(struct device_node *np); static int validate_parent_available(struct device_node *np);
static const struct of_device_id altr_edac_a10_device_of_match[]; static const struct of_device_id altr_edac_a10_device_of_match[];
static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat) static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat)
{ {
int irq; int irq;
struct device_node *child, *np = of_find_compatible_node(NULL, NULL, struct device_node *child, *np;
if (!socfpga_is_a10())
return -ENODEV;
np = of_find_compatible_node(NULL, NULL,
"altr,socfpga-a10-ecc-manager"); "altr,socfpga-a10-ecc-manager");
if (!np) { if (!np) {
edac_printk(KERN_ERR, EDAC_DEVICE, "ECC Manager not found\n"); edac_printk(KERN_ERR, EDAC_DEVICE, "ECC Manager not found\n");
...@@ -1545,8 +1555,12 @@ static const struct edac_device_prv_data a10_sdmmceccb_data = { ...@@ -1545,8 +1555,12 @@ static const struct edac_device_prv_data a10_sdmmceccb_data = {
static int __init socfpga_init_sdmmc_ecc(void) static int __init socfpga_init_sdmmc_ecc(void)
{ {
int rc = -ENODEV; int rc = -ENODEV;
struct device_node *child = of_find_compatible_node(NULL, NULL, struct device_node *child;
"altr,socfpga-sdmmc-ecc");
if (!socfpga_is_a10())
return -ENODEV;
child = of_find_compatible_node(NULL, NULL, "altr,socfpga-sdmmc-ecc");
if (!child) { if (!child) {
edac_printk(KERN_WARNING, EDAC_DEVICE, "SDMMC node not found\n"); edac_printk(KERN_WARNING, EDAC_DEVICE, "SDMMC node not found\n");
return -ENODEV; return -ENODEV;
......
...@@ -40,6 +40,11 @@ ...@@ -40,6 +40,11 @@
#define edac_atomic_scrub(va, size) do { } while (0) #define edac_atomic_scrub(va, size) do { } while (0)
#endif #endif
int edac_op_state = EDAC_OPSTATE_INVAL;
EXPORT_SYMBOL_GPL(edac_op_state);
static int edac_report = EDAC_REPORTING_ENABLED;
/* lock to memory controller's control array */ /* lock to memory controller's control array */
static DEFINE_MUTEX(mem_ctls_mutex); static DEFINE_MUTEX(mem_ctls_mutex);
static LIST_HEAD(mc_devices); static LIST_HEAD(mc_devices);
...@@ -52,6 +57,65 @@ static void const *edac_mc_owner; ...@@ -52,6 +57,65 @@ static void const *edac_mc_owner;
static struct bus_type mc_bus[EDAC_MAX_MCS]; static struct bus_type mc_bus[EDAC_MAX_MCS];
int edac_get_report_status(void)
{
return edac_report;
}
EXPORT_SYMBOL_GPL(edac_get_report_status);
void edac_set_report_status(int new)
{
if (new == EDAC_REPORTING_ENABLED ||
new == EDAC_REPORTING_DISABLED ||
new == EDAC_REPORTING_FORCE)
edac_report = new;
}
EXPORT_SYMBOL_GPL(edac_set_report_status);
static int edac_report_set(const char *str, const struct kernel_param *kp)
{
if (!str)
return -EINVAL;
if (!strncmp(str, "on", 2))
edac_report = EDAC_REPORTING_ENABLED;
else if (!strncmp(str, "off", 3))
edac_report = EDAC_REPORTING_DISABLED;
else if (!strncmp(str, "force", 5))
edac_report = EDAC_REPORTING_FORCE;
return 0;
}
static int edac_report_get(char *buffer, const struct kernel_param *kp)
{
int ret = 0;
switch (edac_report) {
case EDAC_REPORTING_ENABLED:
ret = sprintf(buffer, "on");
break;
case EDAC_REPORTING_DISABLED:
ret = sprintf(buffer, "off");
break;
case EDAC_REPORTING_FORCE:
ret = sprintf(buffer, "force");
break;
default:
ret = -EINVAL;
break;
}
return ret;
}
static const struct kernel_param_ops edac_report_ops = {
.set = edac_report_set,
.get = edac_report_get,
};
module_param_cb(edac_report, &edac_report_ops, &edac_report, 0644);
unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf, unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
unsigned len) unsigned len)
{ {
...@@ -504,22 +568,6 @@ struct mem_ctl_info *find_mci_by_dev(struct device *dev) ...@@ -504,22 +568,6 @@ struct mem_ctl_info *find_mci_by_dev(struct device *dev)
} }
EXPORT_SYMBOL_GPL(find_mci_by_dev); EXPORT_SYMBOL_GPL(find_mci_by_dev);
/*
* handler for EDAC to check if NMI type handler has asserted interrupt
*/
static int edac_mc_assert_error_check_and_clear(void)
{
int old_state;
if (edac_op_state == EDAC_OPSTATE_POLL)
return 1;
old_state = edac_err_assert;
edac_err_assert = 0;
return old_state;
}
/* /*
* edac_mc_workq_function * edac_mc_workq_function
* performs the operation scheduled by a workq request * performs the operation scheduled by a workq request
...@@ -536,7 +584,7 @@ static void edac_mc_workq_function(struct work_struct *work_req) ...@@ -536,7 +584,7 @@ static void edac_mc_workq_function(struct work_struct *work_req)
return; return;
} }
if (edac_mc_assert_error_check_and_clear()) if (edac_op_state == EDAC_OPSTATE_POLL)
mci->edac_check(mci); mci->edac_check(mci);
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
...@@ -601,7 +649,6 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci) ...@@ -601,7 +649,6 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci)
} }
list_add_tail_rcu(&mci->link, insert_before); list_add_tail_rcu(&mci->link, insert_before);
atomic_inc(&edac_handlers);
return 0; return 0;
fail0: fail0:
...@@ -619,7 +666,6 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci) ...@@ -619,7 +666,6 @@ static int add_mc_to_global_list(struct mem_ctl_info *mci)
static int del_mc_from_global_list(struct mem_ctl_info *mci) static int del_mc_from_global_list(struct mem_ctl_info *mci)
{ {
int handlers = atomic_dec_return(&edac_handlers);
list_del_rcu(&mci->link); list_del_rcu(&mci->link);
/* these are for safe removal of devices from global list while /* these are for safe removal of devices from global list while
...@@ -628,7 +674,7 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci) ...@@ -628,7 +674,7 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)
synchronize_rcu(); synchronize_rcu();
INIT_LIST_HEAD(&mci->link); INIT_LIST_HEAD(&mci->link);
return handlers; return list_empty(&mc_devices);
} }
struct mem_ctl_info *edac_mc_find(int idx) struct mem_ctl_info *edac_mc_find(int idx)
...@@ -763,7 +809,7 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev) ...@@ -763,7 +809,7 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
/* mark MCI offline: */ /* mark MCI offline: */
mci->op_state = OP_OFFLINE; mci->op_state = OP_OFFLINE;
if (!del_mc_from_global_list(mci)) if (del_mc_from_global_list(mci))
edac_mc_owner = NULL; edac_mc_owner = NULL;
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
...@@ -1195,8 +1241,11 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type, ...@@ -1195,8 +1241,11 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
/* Report the error via the trace interface */ /* Report the error via the trace interface */
grain_bits = fls_long(e->grain) + 1; grain_bits = fls_long(e->grain) + 1;
if (IS_ENABLED(CONFIG_RAS))
trace_mc_event(type, e->msg, e->label, e->error_count, trace_mc_event(type, e->msg, e->label, e->error_count,
mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer, mci->mc_idx, e->top_layer, e->mid_layer,
e->low_layer,
(e->page_frame_number << PAGE_SHIFT) | e->offset_in_page, (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page,
grain_bits, e->syndrome, e->other_detail); grain_bits, e->syndrome, e->other_detail);
......
/*
* common EDAC components that must be in kernel
*
* Author: Dave Jiang <djiang@mvista.com>
*
* 2007 (c) MontaVista Software, Inc.
* 2010 (c) Advanced Micro Devices Inc.
* Borislav Petkov <bp@alien8.de>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*
*/
#include <linux/module.h>
#include <linux/edac.h>
#include <linux/atomic.h>
#include <linux/device.h>
int edac_op_state = EDAC_OPSTATE_INVAL;
EXPORT_SYMBOL_GPL(edac_op_state);
atomic_t edac_handlers = ATOMIC_INIT(0);
EXPORT_SYMBOL_GPL(edac_handlers);
int edac_err_assert = 0;
EXPORT_SYMBOL_GPL(edac_err_assert);
int edac_report_status = EDAC_REPORTING_ENABLED;
EXPORT_SYMBOL_GPL(edac_report_status);
static int __init edac_report_setup(char *str)
{
if (!str)
return -EINVAL;
if (!strncmp(str, "on", 2))
set_edac_report_status(EDAC_REPORTING_ENABLED);
else if (!strncmp(str, "off", 3))
set_edac_report_status(EDAC_REPORTING_DISABLED);
else if (!strncmp(str, "force", 5))
set_edac_report_status(EDAC_REPORTING_FORCE);
return 0;
}
__setup("edac_report=", edac_report_setup);
/*
* called to determine if there is an EDAC driver interested in
* knowing an event (such as NMI) occurred
*/
int edac_handler_set(void)
{
if (edac_op_state == EDAC_OPSTATE_POLL)
return 0;
return atomic_read(&edac_handlers);
}
EXPORT_SYMBOL_GPL(edac_handler_set);
/*
* handler for NMI type of interrupts to assert error
*/
void edac_atomic_assert_error(void)
{
edac_err_assert++;
}
EXPORT_SYMBOL_GPL(edac_atomic_assert_error);
...@@ -1349,7 +1349,7 @@ static int pnd2_mce_check_error(struct notifier_block *nb, unsigned long val, vo ...@@ -1349,7 +1349,7 @@ static int pnd2_mce_check_error(struct notifier_block *nb, unsigned long val, vo
struct dram_addr daddr; struct dram_addr daddr;
char *type; char *type;
if (get_edac_report_status() == EDAC_REPORTING_DISABLED) if (edac_get_report_status() == EDAC_REPORTING_DISABLED)
return NOTIFY_DONE; return NOTIFY_DONE;
mci = pnd2_mci; mci = pnd2_mci;
......
...@@ -3075,7 +3075,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -3075,7 +3075,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
struct sbridge_pvt *pvt; struct sbridge_pvt *pvt;
char *type; char *type;
if (get_edac_report_status() == EDAC_REPORTING_DISABLED) if (edac_get_report_status() == EDAC_REPORTING_DISABLED)
return NOTIFY_DONE; return NOTIFY_DONE;
mci = get_mci_for_node_id(mce->socketid); mci = get_mci_for_node_id(mce->socketid);
...@@ -3441,7 +3441,7 @@ static int __init sbridge_init(void) ...@@ -3441,7 +3441,7 @@ static int __init sbridge_init(void)
if (rc >= 0) { if (rc >= 0) {
mce_register_decode_chain(&sbridge_mce_dec); mce_register_decode_chain(&sbridge_mce_dec);
if (get_edac_report_status() == EDAC_REPORTING_DISABLED) if (edac_get_report_status() == EDAC_REPORTING_DISABLED)
sbridge_printk(KERN_WARNING, "Loading driver, error reporting disabled.\n"); sbridge_printk(KERN_WARNING, "Loading driver, error reporting disabled.\n");
return 0; return 0;
} }
......
...@@ -971,7 +971,7 @@ static int skx_mce_check_error(struct notifier_block *nb, unsigned long val, ...@@ -971,7 +971,7 @@ static int skx_mce_check_error(struct notifier_block *nb, unsigned long val,
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
char *type; char *type;
if (get_edac_report_status() == EDAC_REPORTING_DISABLED) if (edac_get_report_status() == EDAC_REPORTING_DISABLED)
return NOTIFY_DONE; return NOTIFY_DONE;
/* ignore unless this is memory related with an address */ /* ignore unless this is memory related with an address */
......
This diff is collapsed.
...@@ -28,12 +28,10 @@ struct device; ...@@ -28,12 +28,10 @@ struct device;
#define EDAC_OPSTATE_INT 2 #define EDAC_OPSTATE_INT 2
extern int edac_op_state; extern int edac_op_state;
extern int edac_err_assert;
extern atomic_t edac_handlers;
extern int edac_handler_set(void); struct bus_type *edac_get_sysfs_subsys(void);
extern void edac_atomic_assert_error(void); int edac_get_report_status(void);
extern struct bus_type *edac_get_sysfs_subsys(void); void edac_set_report_status(int new);
enum { enum {
EDAC_REPORTING_ENABLED, EDAC_REPORTING_ENABLED,
...@@ -41,28 +39,6 @@ enum { ...@@ -41,28 +39,6 @@ enum {
EDAC_REPORTING_FORCE EDAC_REPORTING_FORCE
}; };
extern int edac_report_status;
#ifdef CONFIG_EDAC
static inline int get_edac_report_status(void)
{
return edac_report_status;
}
static inline void set_edac_report_status(int new)
{
edac_report_status = new;
}
#else
static inline int get_edac_report_status(void)
{
return EDAC_REPORTING_DISABLED;
}
static inline void set_edac_report_status(int new)
{
}
#endif
static inline void opstate_init(void) static inline void opstate_init(void)
{ {
switch (edac_op_state) { switch (edac_op_state) {
......
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