[PATCH] EDAC/synopsys: Clear the ecc counters at init

Datta, Shubhrajyoti shubhrajyoti.datta at amd.com
Tue Jun 3 22:58:22 PDT 2025


[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Borislav Petkov <bp at alien8.de>
> Sent: Tuesday, June 3, 2025 2:36 PM
> To: Datta, Shubhrajyoti <shubhrajyoti.datta at amd.com>
> Cc: linux-arm-kernel at lists.infradead.org; linux-edac at vger.kernel.org; linux-
> kernel at vger.kernel.org; git (AMD-Xilinx) <git at amd.com>; Simek, Michal
> <michal.simek at amd.com>; Tony Luck <tony.luck at intel.com>; James Morse
> <james.morse at arm.com>; Mauro Carvalho Chehab <mchehab at kernel.org>;
> Robert Richter <rric at kernel.org>
> Subject: Re: [PATCH] EDAC/synopsys: Clear the ecc counters at init
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, May 28, 2025 at 12:26:50PM +0530, Shubhrajyoti Datta wrote:
> > Subject: Re: [PATCH] EDAC/synopsys: Clear the ecc counters at init
>
> s/ecc/ECC/g
>
> > Clear ECC error and counter registers at init to ensure a clean state
> > by clearing all ECC error and counter registers before registering the
> > controller with the EDAC framework.
> >
> > This avoids reporting stale errors that may have occurred during boot
> > or prior configuration.
>
> Run this commit message through AI and ask it to shorten it and write it in
> imperative tone.
>
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta at amd.com>
> > ---
> >
> >  drivers/edac/synopsys_edac.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/edac/synopsys_edac.c
> > b/drivers/edac/synopsys_edac.c index 5ed32a3299c4..ebd2d6e771a1
> 100644
> > --- a/drivers/edac/synopsys_edac.c
> > +++ b/drivers/edac/synopsys_edac.c
> > @@ -755,7 +755,7 @@ static bool zynq_get_ecc_state(void __iomem
> *base)
> > static bool zynqmp_get_ecc_state(void __iomem *base)  {
> >       enum dev_type dt;
> > -     u32 ecctype;
> > +     u32 ecctype, clearval;
> >
> >       dt = zynqmp_get_dtype(base);
> >       if (dt == DEV_UNKNOWN)
> > @@ -763,8 +763,13 @@ static bool zynqmp_get_ecc_state(void __iomem
> > *base)
> >
> >       ecctype = readl(base + ECC_CFG0_OFST) & SCRUB_MODE_MASK;
> >       if ((ecctype == SCRUB_MODE_SECDED) &&
> > -         ((dt == DEV_X2) || (dt == DEV_X4) || (dt == DEV_X8)))
> > +         ((dt == DEV_X2) || (dt == DEV_X4) || (dt == DEV_X8))) {
> > +             clearval = readl(base + ECC_CLR_OFST) |
> > +                             ECC_CTRL_CLR_CE_ERR | ECC_CTRL_CLR_CE_ERRCNT |
> > +                             ECC_CTRL_CLR_UE_ERR | ECC_CTRL_CLR_UE_ERRCNT;
> > +             writel(clearval, base + ECC_CLR_OFST);
>
> A getter function clears registers and commit message talks about "at init"?!?!
>
> This looks like a hack.


zynqmp_get_ecc_state is getting called from probe/init.
I will update the commit message to reflect the same.

>
> --
> Regards/Gruss,
>     Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette


More information about the linux-arm-kernel mailing list