Commit 315bada6 authored by Jia He's avatar Jia He Committed by Borislav Petkov

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: default avatarToshi Kani <toshi.kani@hpe.com>
Signed-off-by: default avatarJia He <justin.he@arm.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221010023559.69655-6-justin.he@arm.com
parent 802e7f1d
...@@ -4329,6 +4329,9 @@ static int __init amd64_edac_init(void) ...@@ -4329,6 +4329,9 @@ static int __init amd64_edac_init(void)
int err = -ENODEV; int err = -ENODEV;
int i; int i;
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY; return -EBUSY;
......
...@@ -599,6 +599,9 @@ static int __init armada_xp_edac_init(void) ...@@ -599,6 +599,9 @@ static int __init armada_xp_edac_init(void)
{ {
int res; int res;
if (ghes_get_devices())
return -EBUSY;
/* only polling is supported */ /* only polling is supported */
edac_op_state = EDAC_OPSTATE_POLL; edac_op_state = EDAC_OPSTATE_POLL;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef __EDAC_MODULE_H__ #ifndef __EDAC_MODULE_H__
#define __EDAC_MODULE_H__ #define __EDAC_MODULE_H__
#include <acpi/ghes.h>
#include "edac_mc.h" #include "edac_mc.h"
#include "edac_pci.h" #include "edac_pci.h"
#include "edac_device.h" #include "edac_device.h"
......
...@@ -756,6 +756,9 @@ static int __init i10nm_init(void) ...@@ -756,6 +756,9 @@ static int __init i10nm_init(void)
edac_dbg(2, "\n"); edac_dbg(2, "\n");
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY; return -EBUSY;
......
...@@ -1271,6 +1271,9 @@ static int __init igen6_init(void) ...@@ -1271,6 +1271,9 @@ static int __init igen6_init(void)
edac_dbg(2, "\n"); edac_dbg(2, "\n");
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -ENODEV; return -ENODEV;
......
...@@ -38,6 +38,9 @@ static int __init fsl_ddr_mc_init(void) ...@@ -38,6 +38,9 @@ static int __init fsl_ddr_mc_init(void)
{ {
int res; int res;
if (ghes_get_devices())
return -EBUSY;
/* make sure error reporting method is sane */ /* make sure error reporting method is sane */
switch (edac_op_state) { switch (edac_op_state) {
case EDAC_OPSTATE_POLL: case EDAC_OPSTATE_POLL:
......
...@@ -1528,6 +1528,9 @@ static int __init pnd2_init(void) ...@@ -1528,6 +1528,9 @@ static int __init pnd2_init(void)
edac_dbg(2, "\n"); edac_dbg(2, "\n");
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY; return -EBUSY;
......
...@@ -3634,6 +3634,9 @@ static int __init sbridge_init(void) ...@@ -3634,6 +3634,9 @@ static int __init sbridge_init(void)
edac_dbg(2, "\n"); edac_dbg(2, "\n");
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY; return -EBUSY;
......
...@@ -653,6 +653,9 @@ static int __init skx_init(void) ...@@ -653,6 +653,9 @@ static int __init skx_init(void)
edac_dbg(2, "\n"); edac_dbg(2, "\n");
if (ghes_get_devices())
return -EBUSY;
owner = edac_get_owner(); owner = edac_get_owner();
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR))) if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
return -EBUSY; return -EBUSY;
......
...@@ -2114,6 +2114,9 @@ static int __init thunderx_edac_init(void) ...@@ -2114,6 +2114,9 @@ static int __init thunderx_edac_init(void)
{ {
int rc = 0; int rc = 0;
if (ghes_get_devices())
return -EBUSY;
rc = pci_register_driver(&thunderx_lmc_driver); rc = pci_register_driver(&thunderx_lmc_driver);
if (rc) if (rc)
return rc; return rc;
......
...@@ -2004,6 +2004,9 @@ static int __init xgene_edac_init(void) ...@@ -2004,6 +2004,9 @@ static int __init xgene_edac_init(void)
{ {
int rc; int rc;
if (ghes_get_devices())
return -EBUSY;
/* Make sure error reporting method is sane */ /* Make sure error reporting method is sane */
switch (edac_op_state) { switch (edac_op_state) {
case EDAC_OPSTATE_POLL: case EDAC_OPSTATE_POLL:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment