Re: 回复: [PATCH] ACPI: APEI: move edac_init ahead of ghes platform drv register

Borislav Petkov
2022-08-09T11:16:00Z

On Tue, Aug 09, 2022 at 09:24:33AM +0000, Justin He wrote:
> If no, what is the detail logic of ghes_edac_driver_is_preferred()?

That should be moved from ghes_edac.c to ghes.c:

/*
* Known systems that are safe to enable this module.
*/
static struct acpi_platform_list plat_list[] = {
{"HPE ", "Server ", 0, ACPI_SIG_FADT, all_versions},
{ } /* End */
};

and then

bool ghes_edac_driver_is_preferred()
{
if (IS_ENABLED(CONFIG_X86)) {
/* Check if safe to enable on this system */
idx = acpi_match_platform_list(plat_list);
} else if (ARM) {
/* insert ARM logic here */
}
}

That function should be called by the EDAC modules which compete with
ghes_edac.

In the x86 case, that's sb_edac, skx_edac and amd64_edac, I guess.

It all depends on what platforms Toshi wants to load it - I'm guessing
HPE has both Intel and AMD platforms where they prefer ghes_edac.

On ARM, that's up to ARM folks.

> Because I notice that lots of other edac drivers are probing like:
> ...
> owner = edac_get_owner();
> if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
> return -EBUSY;

No, that's a silly mechanism to allow a single EDAC driver to load on
the system. But your test will go before it, at the very beginning of
the init function.

HTH.

--
Regards/Gruss,
Boris.