Skip to content

Commit 1d512b1

Browse files
qzhuo2aegl
authored andcommitted
EDAC/igen6: Initialize edac_op_state according to the configuration data
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 <[email protected]> Signed-off-by: Tony Luck <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent fefaae9 commit 1d512b1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/edac/igen6_edac.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,15 @@ static void unregister_err_handler(void)
13501350
unregister_nmi_handler(NMI_SERR, IGEN6_NMI_NAME);
13511351
}
13521352

1353+
static void opstate_set(struct res_config *cfg)
1354+
{
1355+
/* Set the mode according to the configuration data. */
1356+
if (cfg->machine_check)
1357+
edac_op_state = EDAC_OPSTATE_INT;
1358+
else
1359+
edac_op_state = EDAC_OPSTATE_NMI;
1360+
}
1361+
13531362
static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
13541363
{
13551364
u64 mchbar;
@@ -1367,6 +1376,8 @@ static int igen6_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
13671376
if (rc)
13681377
goto fail;
13691378

1379+
opstate_set(res_cfg);
1380+
13701381
for (i = 0; i < res_cfg->num_imc; i++) {
13711382
rc = igen6_register_mci(i, mchbar, pdev);
13721383
if (rc)
@@ -1450,8 +1461,6 @@ static int __init igen6_init(void)
14501461
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
14511462
return -EBUSY;
14521463

1453-
edac_op_state = EDAC_OPSTATE_NMI;
1454-
14551464
rc = pci_register_driver(&igen6_driver);
14561465
if (rc)
14571466
return rc;

0 commit comments

Comments
 (0)