[PATCH 1/1] EDAC/igen6: Initialize edac_op_state according to the configuration data
From: Qiuxu Zhuo
Date: Sat Nov 02 2024 - 04:15:09 EST
Currently, igen6_edac sets edac_op_state to EDAC_OPSTATE_NMI, while the
driver also supports memory errors reported from Machine Check. Initialize
edac_op_state to the correct value according to the configuration data
that the driver probed.
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@xxxxxxxxx>
---
drivers/edac/igen6_edac.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index 189a2fc29e74..b6ac14b69358 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -1348,6 +1348,15 @@ static void unregister_err_handler(void)
unregister_nmi_handler(NMI_SERR, IGEN6_NMI_NAME);
}
+static void opstate_set(struct res_config *cfg)
+{
+ /* Set the mode according to the configuration data. */
+ if (cfg->machine_check)
+ edac_op_state =3D EDAC_OPSTATE_INT;
+ else
+ edac_op_state =3D EDAC_OPSTATE_NMI;
+}
+
static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *e=
nt)
{
u64 mchbar;
@@ -1365,6 +1374,8 @@ static int igen6_probe(struct pci_dev *pdev, const st=
ruct pci_device_id *ent)
if (rc)
goto fail;
+ opstate_set(res_cfg);
+
for (i =3D 0; i < res_cfg->num_imc; i++) {
rc =3D igen6_register_mci(i, mchbar, pdev);
if (rc)
@@ -1448,8 +1459,6 @@ static int __init igen6_init(void)
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
- edac_op_state =3D EDAC_OPSTATE_NMI;
-
rc =3D pci_register_driver(&igen6_driver);
if (rc)
return rc;
--
2.17.1
[2]
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index 4f38bb1c1fc3..c8b6e41a12b5 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -1368,6 +1368,10 @@ static void unregister_err_handler(void)
static void opstate_set(struct res_config *cfg)
{
+ /* Only the polling mode can be set via the module parameter. */
+ if (edac_op_state =3D=3D EDAC_OPSTATE_POLL)
+ return;
+
/* Set the mode according to the configuration data. */
if (cfg->machine_check)
edac_op_state =3D EDAC_OPSTATE_INT;
@@ -1505,4 +1509,4 @@ MODULE_AUTHOR("Qiuxu Zhuo");
MODULE_DESCRIPTION("MC Driver for Intel client SoC using In-Band ECC");
module_param(edac_op_state, int, 0444);
-MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=3DPoll,1=3D=
NMI. Default=3D1");
+MODULE_PARM_DESC(edac_op_state, "EDAC Error Reporting state: 0=3DPoll, Oth=
ers or default=3DAuto detect");