summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Tibude <tushar.tibude1000@gmail.com>2026-04-30 11:42:21 +0300
committerTony Luck <tony.luck@intel.com>2026-05-29 18:34:11 +0300
commitdfe7d89d200b08f8387ca224039495b210272e28 (patch)
tree328a68e1fa49dc5615fd8f4ab3df090fd3ef631c
parent7944f44098c277d0a5e34a4d9d078077d05f51af (diff)
downloadlinux-dfe7d89d200b08f8387ca224039495b210272e28.tar.xz
EDAC/i5000: disable error reporting at teardown and refactor helper
If error reporting is enabled during initialization but initialization fails immediately after, or during normal driver teardown, error reporting is left enabled in the mask register even after exit. Replace i5000_enable_error_reporting() with i5000_set_error_reporting() to combine enabling/disabling. Disable reporting at initialization failure and driver exit, before call to i5000_put_devices() for cleanup. This ensures clean hardware handling by disabling any unused error reporting bits before exiting. Signed-off-by: Tushar Tibude <tushar.tibude1000@gmail.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Link: https://patch.msgid.link/20260430084223.9298-2-tushar.tibude1000@gmail.com
-rw-r--r--drivers/edac/i5000_edac.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 471b8540d18b..c0faf55f7812 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -352,6 +352,9 @@ struct i5000_pvt {
/* Actual values for this controller */
int maxch; /* Max channels */
int maxdimmperch; /* Max DIMMs per channel */
+
+ /* Hardware error reporting status */
+ bool enabled_error_reporting;
};
/* I5000 MCH error information retrieved from Hardware */
@@ -1302,10 +1305,10 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)
}
/*
- * i5000_enable_error_reporting
- * Turn on the memory reporting features of the hardware
+ * i5000_set_error_reporting
+ * Turn on/off the memory reporting features of the hardware
*/
-static void i5000_enable_error_reporting(struct mem_ctl_info *mci)
+static void i5000_set_error_reporting(struct mem_ctl_info *mci, bool enable)
{
struct i5000_pvt *pvt;
u32 fbd_error_mask;
@@ -1316,8 +1319,11 @@ static void i5000_enable_error_reporting(struct mem_ctl_info *mci)
pci_read_config_dword(pvt->branchmap_werrors, EMASK_FBD,
&fbd_error_mask);
- /* Enable with a '0' */
- fbd_error_mask &= ~(ENABLE_EMASK_ALL);
+ /* Enable with 0, disable with 1 */
+ if (enable)
+ fbd_error_mask &= ~(ENABLE_EMASK_ALL);
+ else
+ fbd_error_mask |= ENABLE_EMASK_ALL;
pci_write_config_dword(pvt->branchmap_werrors, EMASK_FBD,
fbd_error_mask);
@@ -1435,17 +1441,19 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx)
if (i5000_init_csrows(mci)) {
edac_dbg(0, "MC: Setting mci->edac_cap to EDAC_FLAG_NONE because i5000_init_csrows() returned nonzero value\n");
mci->edac_cap = EDAC_FLAG_NONE; /* no csrows found */
+ pvt->enabled_error_reporting = false;
} else {
edac_dbg(1, "MC: Enable error reporting now\n");
- i5000_enable_error_reporting(mci);
+ i5000_set_error_reporting(mci, true);
+ pvt->enabled_error_reporting = true;
}
/* add this new MC control structure to EDAC's list of MCs */
if (edac_mc_add_mc(mci)) {
edac_dbg(0, "MC: failed edac_mc_add_mc()\n");
- /* FIXME: perhaps some code should go here that disables error
- * reporting if we just enabled it
- */
+ /* Disable error reporting if we previously enabled it */
+ if (pvt->enabled_error_reporting)
+ i5000_set_error_reporting(mci, false);
goto fail1;
}
@@ -1503,6 +1511,7 @@ static int i5000_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
static void i5000_remove_one(struct pci_dev *pdev)
{
struct mem_ctl_info *mci;
+ struct i5000_pvt *pvt;
edac_dbg(0, "\n");
@@ -1512,6 +1521,12 @@ static void i5000_remove_one(struct pci_dev *pdev)
if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
return;
+ pvt = mci->pvt_info;
+
+ /* Disable error reporting on teardown */
+ if (pvt->enabled_error_reporting)
+ i5000_set_error_reporting(mci, false);
+
/* retrieve references to resources, and free those resources */
i5000_put_devices(mci);
edac_mc_free(mci);