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 <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
This commit is contained in:
Jia He 2022-10-10 02:35:57 +00:00 committed by Borislav Petkov
parent 802e7f1dfe
commit 315bada690
11 changed files with 31 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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: