Skip to content

Commit 315bada

Browse files
justin-hesuryasaimadhu
authored andcommitted
EDAC: Check for GHES preference in the chipset-specific EDAC drivers
Call ghes_get_devices() to check whether ghes_edac should be used on the platform where it is preferred over the corresponding chipset-specific EDAC driver. Unlike the existing edac_get_owner() check, the ghes_get_devices() check works independent to the module_init ordering. [ bp: Massage. ] Suggested-by: Toshi Kani <[email protected]> Signed-off-by: Jia He <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 802e7f1 commit 315bada

File tree

11 files changed

+31
-0
lines changed

11 files changed

+31
-0
lines changed

drivers/edac/amd64_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4329,6 +4329,9 @@ static int __init amd64_edac_init(void)
43294329
int err = -ENODEV;
43304330
int i;
43314331

4332+
if (ghes_get_devices())
4333+
return -EBUSY;
4334+
43324335
owner = edac_get_owner();
43334336
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
43344337
return -EBUSY;

drivers/edac/armada_xp_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ static int __init armada_xp_edac_init(void)
599599
{
600600
int res;
601601

602+
if (ghes_get_devices())
603+
return -EBUSY;
604+
602605
/* only polling is supported */
603606
edac_op_state = EDAC_OPSTATE_POLL;
604607

drivers/edac/edac_module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef __EDAC_MODULE_H__
1212
#define __EDAC_MODULE_H__
1313

14+
#include <acpi/ghes.h>
1415
#include "edac_mc.h"
1516
#include "edac_pci.h"
1617
#include "edac_device.h"

drivers/edac/i10nm_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,9 @@ static int __init i10nm_init(void)
756756

757757
edac_dbg(2, "\n");
758758

759+
if (ghes_get_devices())
760+
return -EBUSY;
761+
759762
owner = edac_get_owner();
760763
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
761764
return -EBUSY;

drivers/edac/igen6_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,9 @@ static int __init igen6_init(void)
12711271

12721272
edac_dbg(2, "\n");
12731273

1274+
if (ghes_get_devices())
1275+
return -EBUSY;
1276+
12741277
owner = edac_get_owner();
12751278
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
12761279
return -ENODEV;

drivers/edac/layerscape_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ static int __init fsl_ddr_mc_init(void)
3838
{
3939
int res;
4040

41+
if (ghes_get_devices())
42+
return -EBUSY;
43+
4144
/* make sure error reporting method is sane */
4245
switch (edac_op_state) {
4346
case EDAC_OPSTATE_POLL:

drivers/edac/pnd2_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,9 @@ static int __init pnd2_init(void)
15281528

15291529
edac_dbg(2, "\n");
15301530

1531+
if (ghes_get_devices())
1532+
return -EBUSY;
1533+
15311534
owner = edac_get_owner();
15321535
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
15331536
return -EBUSY;

drivers/edac/sb_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,6 +3634,9 @@ static int __init sbridge_init(void)
36343634

36353635
edac_dbg(2, "\n");
36363636

3637+
if (ghes_get_devices())
3638+
return -EBUSY;
3639+
36373640
owner = edac_get_owner();
36383641
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
36393642
return -EBUSY;

drivers/edac/skx_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ static int __init skx_init(void)
653653

654654
edac_dbg(2, "\n");
655655

656+
if (ghes_get_devices())
657+
return -EBUSY;
658+
656659
owner = edac_get_owner();
657660
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
658661
return -EBUSY;

drivers/edac/thunderx_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,9 @@ static int __init thunderx_edac_init(void)
21142114
{
21152115
int rc = 0;
21162116

2117+
if (ghes_get_devices())
2118+
return -EBUSY;
2119+
21172120
rc = pci_register_driver(&thunderx_lmc_driver);
21182121
if (rc)
21192122
return rc;

0 commit comments

Comments
 (0)