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

Yazen Ghannam
2022-03-23T18:30:43Z

On Mon, Feb 28, 2022 at 09:43:45PM +0530, Naveen Krishna Chatradhi wrote:
> From: Muralidhara M K <muralimk@amd.com>
>
> Add function pointer for determine_ecc_sym_sz() in pvt->ops and assign
> family specific get_ecc_sym_sz() 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 | 49 ++++++++++++++++++++++++---------------
> drivers/edac/amd64_edac.h | 1 +
> 2 files changed, 31 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 07428a6c7683..69c33eb17e4f 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -3176,26 +3176,11 @@ static void free_mc_sibling_devs(struct amd64_pvt *pvt)
> }
> }
>
> -static void determine_ecc_sym_sz(struct amd64_pvt *pvt)
> +static void f1x_determine_ecc_sym_sz(struct amd64_pvt *pvt)
> {
> pvt->ecc_sym_sz = 4;
>
> - if (pvt->umc) {
> - u8 i;
> -
> - for_each_umc(i) {
> - /* Check enabled channels only: */
> - if (pvt->umc[i].sdp_ctrl & UMC_SDP_INIT) {
> - if (pvt->umc[i].ecc_ctrl & BIT(9)) {
> - pvt->ecc_sym_sz = 16;
> - return;
> - } else if (pvt->umc[i].ecc_ctrl & BIT(7)) {
> - pvt->ecc_sym_sz = 8;
> - return;
> - }
> - }
> - }
> - } else if (pvt->fam >= 0x10) {
> + if (pvt->fam >= 0x10) {
> u32 tmp;
>
> amd64_read_pci_cfg(pvt->F3, EXT_NB_MCA_CFG, &tmp);
> @@ -3209,6 +3194,26 @@ static void determine_ecc_sym_sz(struct amd64_pvt *pvt)
> }
> }
>
> +static void f17_determine_ecc_sym_sz(struct amd64_pvt *pvt)
> +{
> + u8 i;
> +
> + pvt->ecc_sym_sz = 4;
> +
> + for_each_umc(i) {
> + /* Check enabled channels only: */
> + if (pvt->umc[i].sdp_ctrl & UMC_SDP_INIT) {
> + if (pvt->umc[i].ecc_ctrl & BIT(9)) {
> + pvt->ecc_sym_sz = 16;
> + return;
> + } else if (pvt->umc[i].ecc_ctrl & BIT(7)) {
> + pvt->ecc_sym_sz = 8;
> + return;
> + }
> + }
> + }
> +}

We should reconsider if this is needed. The ECC symbol size was needed on
legacy systems to decode the syndrome. The MCA_SYND register includes the
syndrome on Zen-based systems, so the symbol size is only used for a single
pr_info().

Thanks,
Yazen