Re: [PATCH v2 04/31] EDAC/amd64: Allow for DF Indirect Broadcast reads

From: Borislav Petkov
Date: Wed Jun 30 2021 - 12:23:09 EST


On Wed, Jun 23, 2021 at 07:19:35PM +0000, Yazen Ghannam wrote:
> The DF Indirect Access method allows for "Broadcast" accesses in which
> case no specific instance is targeted. Add support using a reserved
> instance ID of 0xFF to indicate a broadcast access. Set the FICAA
> register appropriately.
>
> Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
> ---
> Link:
> https://lkml.kernel.org/r/20210507190140.18854-1-Yazen.Ghannam@xxxxxxx
>
> v1->v2:
> * New in v2.
>
> drivers/edac/amd64_edac.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index b94067e3952b..d67cd8f57b94 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1010,7 +1010,11 @@ struct df_reg {
> *
> * Fabric Indirect Configuration Access Data (FICAD): There are FICAD LO
> * and FICAD HI registers but so far we only need the LO register.
> + *
> + * Use Instance Id 0xFF to indicate a broadcast read.
> */
> +
> +#define DF_BROADCAST 0xFF
> static int amd_df_indirect_read(u16 node, struct df_reg reg, u8 instance_id, u32 *lo)
> {
> struct pci_dev *F4;
> @@ -1024,7 +1028,7 @@ static int amd_df_indirect_read(u16 node, struct df_reg reg, u8 instance_id, u32
> if (!F4)
> goto out;
>
> - ficaa = 1;
> + ficaa = (instance_id == DF_BROADCAST) ? 0 : 1;

Or, you can define two functions:

df_indirect_read_broadcast()
df_indirect_read_umc()

(no need for the "amd_" prefix either - this is a static function now)

which both call a low-level helper:

static int __df_indirect_read(u16 node, struct df_reg reg, u8 instance_id, u32 *lo)

and there you either pass the instance_id or 0xff depending on which
outer function is calling it...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette