Re: [PATCH v4 1/2] EDAC/amd64: Set memory type per DIMM

From: Yazen Ghannam
Date: Thu Feb 24 2022 - 13:18:56 EST


On Wed, Feb 23, 2022 at 09:55:08PM +0100, Borislav Petkov wrote:
> On Wed, Feb 02, 2022 at 02:43:06PM +0000, Yazen Ghannam wrote:
> > +static void _determine_memory_type_df(struct amd64_umc *umc)
>
> You don't need this function, right?
>
> IOW, here's what I've applied:
>

...

>
> -static void determine_memory_type(struct amd64_pvt *pvt)
> +static void determine_memory_type_df(struct amd64_pvt *pvt)
> {
> - u32 dram_ctrl, dcsm;
> + struct amd64_umc *umc;
> + u32 i;
>
> - if (pvt->umc) {
> - if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(5))
> - pvt->dram_type = MEM_LRDDR4;
> - else if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(4))
> - pvt->dram_type = MEM_RDDR4;
> + for_each_umc(i) {
> + umc = &pvt->umc[i];
> +
> + if (!(umc->sdp_ctrl & UMC_SDP_INIT)) {
> + umc->dram_type = MEM_EMPTY;
> + continue;
> + }
> +
> + if (umc->dimm_cfg & BIT(5))
> + umc->dram_type = MEM_LRDDR4;
> + else if (umc->dimm_cfg & BIT(4))
> + umc->dram_type = MEM_RDDR4;
> else
> - pvt->dram_type = MEM_DDR4;
> - return;
> + umc->dram_type = MEM_DDR4;
> +
> + edac_dbg(1, " UMC%d DIMM type: %s\n", i, edac_mem_types[umc->dram_type]);
> }
> +}

Ah, I see. You got rid of the extra helper function. Makes sense and looks
okay to me.

Thanks,
Yazen