Skip to content

Commit

Permalink
EDAC: Check for GHES preference in the chipset-specific EDAC drivers
Browse files Browse the repository at this point in the history
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 <toshi.kani@hpe.com>
Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221010023559.69655-6-justin.he@arm.com
  • Loading branch information
Jia He authored and Borislav Petkov committed Oct 21, 2022
1 parent 802e7f1 commit 315bada
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/edac/amd64_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -4329,6 +4329,9 @@ static int __init amd64_edac_init(void)
int err = -ENODEV;
int i;

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/armada_xp_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ static int __init armada_xp_edac_init(void)
{
int res;

if (ghes_get_devices())
return -EBUSY;

/* only polling is supported */
edac_op_state = EDAC_OPSTATE_POLL;

Expand Down
1 change: 1 addition & 0 deletions drivers/edac/edac_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef __EDAC_MODULE_H__
#define __EDAC_MODULE_H__

#include <acpi/ghes.h>
#include "edac_mc.h"
#include "edac_pci.h"
#include "edac_device.h"
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/i10nm_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,9 @@ static int __init i10nm_init(void)

edac_dbg(2, "\n");

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/igen6_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,9 @@ static int __init igen6_init(void)

edac_dbg(2, "\n");

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -ENODEV;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/layerscape_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ static int __init fsl_ddr_mc_init(void)
{
int res;

if (ghes_get_devices())
return -EBUSY;

/* make sure error reporting method is sane */
switch (edac_op_state) {
case EDAC_OPSTATE_POLL:
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/pnd2_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,9 @@ static int __init pnd2_init(void)

edac_dbg(2, "\n");

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/sb_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3634,6 +3634,9 @@ static int __init sbridge_init(void)

edac_dbg(2, "\n");

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/skx_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,9 @@ static int __init skx_init(void)

edac_dbg(2, "\n");

if (ghes_get_devices())
return -EBUSY;

owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/thunderx_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,9 @@ static int __init thunderx_edac_init(void)
{
int rc = 0;

if (ghes_get_devices())
return -EBUSY;

rc = pci_register_driver(&thunderx_lmc_driver);
if (rc)
return rc;
Expand Down
3 changes: 3 additions & 0 deletions drivers/edac/xgene_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,9 @@ static int __init xgene_edac_init(void)
{
int rc;

if (ghes_get_devices())
return -EBUSY;

/* Make sure error reporting method is sane */
switch (edac_op_state) {
case EDAC_OPSTATE_POLL:
Expand Down

0 comments on commit 315bada

Please sign in to comment.