Re: [PATCH 04/14] EDAC/amd64: Add determine_memory_type() into pvt->ops

Yazen Ghannam
2022-03-23T18:20:21Z

On Mon, Feb 28, 2022 at 09:43:44PM +0530, Naveen Krishna Chatradhi wrote:
> From: Muralidhara M K <muralimk@amd.com>
>
> Add function pointer for determine_memory_type() in pvt->ops and
> assign family specific determine_memory_type() definitions
> appropriately.
>

Please include the "why".

> Signed-off-by: Muralidhara M K <muralimk@amd.com>
> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
> ---
> This patch is created by splitting the 5/12th patch in series
> [v7 5/12] https://patchwork.kernel.org/project/linux-edac/patch/20220203174942.31630-6-nchatrad@amd.com/
>
> drivers/edac/amd64_edac.c | 33 ++++++++++++++++++++-------------
> drivers/edac/amd64_edac.h | 1 +
> 2 files changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 708c4bbc0d1c..07428a6c7683 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1632,20 +1632,10 @@ static void read_dct_base_mask(struct amd64_pvt *pvt)
> }
> }
>
> -static void determine_memory_type(struct amd64_pvt *pvt)
> +static void f1x_determine_memory_type(struct amd64_pvt *pvt)
> {
> u32 dram_ctrl, dcsm;
>
> - 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;
> - else
> - pvt->dram_type = MEM_DDR4;
> - return;
> - }
> -
> switch (pvt->fam) {
> case 0xf:
> if (pvt->ext_model >= K8_REV_F)
> @@ -1701,6 +1691,16 @@ static void determine_memory_type(struct amd64_pvt *pvt)
> pvt->dram_type = (pvt->dclr0 & BIT(16)) ? MEM_DDR3 : MEM_RDDR3;
> }
>
> +static void f17_determine_memory_type(struct amd64_pvt *pvt)
> +{
> + 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;
> + else
> + pvt->dram_type = MEM_DDR4;
> +}
> +

This will need some rework due to upstream changes.

Thanks,
Yazen