From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Paul Louvel <paul.louvel@bootlin.com>
Cc: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-edac@vger.kernel.org, devicetree@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Herve Codina <herve.codina@bootlin.com>
Subject: Re: [PATCH v8 2/3] EDAC/cadence: Add Cadence DDR EDAC driver
Date: Fri, 20 Nov 2026 12:19:59 +0100 [thread overview]
Message-ID: <awAs386mgR23nmJ2@ninjato> (raw)
In-Reply-To: <20261118-paul-v7-3-rc1-edac-v8-2-ed791084cc19@bootlin.com>
Hi Paul,
could you comment on these, please?
Happy hacking,
Wolfram
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Medium] EDAC/cadence: cdns_setup_mc() reports SECDED mode when ECC is
> disabled
> - [Medium] EDAC/cadence: missing memory base PFN offset in
> cdns_mc_err_handler()
> --
>
> commit 75a0021a276efa3f6b0c9a800bd2617eb0141dff
> Author: Paul Louvel <paul.louvel@bootlin.com>
>
> EDAC/cadence: Add Cadence DDR EDAC driver
>
> This commit adds an EDAC driver for the Cadence DDR memory controller on
> Renesas RZ/N1x SoCs, supporting SECDED error reporting, software
> scrubbing, and debugfs error injection.
>
> > diff --git a/drivers/edac/cadence_edac.c b/drivers/edac/cadence_edac.c
> > new file mode 100644
> > index 0000000000000..a3b72116ba129
> > --- /dev/null
> > +++ b/drivers/edac/cadence_edac.c
> [ ... ]
> > +static irqreturn_t cdns_mc_err_handler(int irq, void *dev_id)
> > +{
> > + struct mem_ctl_info *mci = dev_id;
> > + struct mc_priv *priv = mci->pvt_info;
> > + u32 status, err_addr, syndrome, reg;
> > +
> > + status = readl(priv->io_base + CDNS_ECC_INT_STAT);
> > + if (!status)
> > + return IRQ_NONE;
> > +
> > + /*
> > + * Hardware is not exposing how many CE / UE occurred since last ACK in
> > + * case of multiple errors. Always set the error count to 1.
> > + */
> > +
> > + if (status & (CDNS_ECC_INT_STAT_UE | CDNS_ECC_INT_STAT_MULTIPLE_UE)) {
> > + reg = readl(priv->io_base + CDNS_ECC_U_ERR_STAT);
> > + syndrome = CDNS_ECC_ERR_STAT_GET_SYNDROME(reg);
> > +
> > + err_addr = readl(priv->io_base + CDNS_ECC_U_ERR_ADDR);
> > +
> > + edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, err_addr >> PAGE_SHIFT,
> > + err_addr & ~PAGE_MASK, syndrome, 0, 0, -1, mci->ctl_name, "");
> > + }
> > +
> > + if (status & (CDNS_ECC_INT_STAT_CE | CDNS_ECC_INT_STAT_MULTIPLE_CE)) {
> > + reg = readl(priv->io_base + CDNS_ECC_C_ERR_STAT);
> > + syndrome = CDNS_ECC_ERR_STAT_GET_SYNDROME(reg);
> > +
> > + err_addr = readl(priv->io_base + CDNS_ECC_C_ERR_ADDR);
> > +
> > + edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, err_addr >> PAGE_SHIFT,
> > + err_addr & ~PAGE_MASK, syndrome, 0, 0, -1, mci->ctl_name, "");
> > + }
>
> [Severity: Medium]
> Does passing err_addr >> PAGE_SHIFT directly to edac_mc_handle_error()
> miss the physical memory base offset?
>
> On Renesas RZ/N1 (r9a06g032), system DDR starts at physical address
> 0x80000000, while the Cadence/Denali controller logs 0-based DRAM offsets
> in CDNS_ECC_U_ERR_ADDR and CDNS_ECC_C_ERR_ADDR. cdns_setup_mc() fetches
> the /memory resource into res and enables SCRUB_SW_SRC, but discards
> res.start and leaves mci->ctl_page_to_phys unset. Without adding
> PHYS_PFN(res.start), edac_mc_handle_error() reports a 0-based PFN and
> edac_mc_scrub_block() fails pfn_valid(), silently skipping software ECC
> scrubbing.
>
> [ ... ]
> > + reg = readl(priv->io_base + CDNS_ECC_STAT);
> > + if (!CDNS_ECC_STAT_IS_ENABLED(reg))
> > + mci->edac_cap = EDAC_FLAG_NONE;
> > + else
> > + mci->edac_cap = EDAC_FLAG_SECDED;
> > +
> > + mci->mtype_cap = MEM_FLAG_DDR2 | MEM_FLAG_DDR3;
> > + mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED;
> > + mci->mod_name = pdev->dev.driver->name;
> > + mci->ctl_name = "cdns-ddr-ctrl";
> > + mci->dev_name = dev_name(&pdev->dev);
> > + mci->scrub_mode = SCRUB_SW_SRC;
> > +
> > + dimm = *mci->dimms;
> > + dimm->nr_pages = PFN_UP(mem_sz);
> > + dimm->grain = 4;
> > + dimm->edac_mode = EDAC_SECDED;
>
> [Severity: Medium]
> Should cdns_setup_mc() set dimm->edac_mode to EDAC_SECDED and continue
> probing when CDNS_ECC_STAT_IS_ENABLED(reg) is false?
>
> When the bootloader has not enabled ECC, mci->edac_cap is set to
> EDAC_FLAG_NONE, but dimm->edac_mode is still hardcoded to EDAC_SECDED.
> Because EDAC sysfs exposes dimm->edac_mode via dimm_edac_mode, userspace
> monitoring tools will see SECDED reported as active while the driver also
> requests the ECC interrupt, unmasks CDNS_ECC_INT_EDAC, and exposes debugfs
> error injection on a controller with ECC disabled. Failing probe with
> -ENODEV (as documented in Kconfig that ECC must be configured by the
> bootloader) or setting dimm->edac_mode = EDAC_NONE would avoid reporting
> active ECC.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261118-paul-v7-3-rc1-edac-v8-0-ed791084cc19@bootlin.com?part=2
next prev parent reply other threads:[~2026-11-20 11:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 10:05 [PATCH v8 0/3] Add Renesas RZ/N1x EDAC driver Paul Louvel
2026-11-18 10:05 ` [PATCH v8 1/3] dt-bindings: edac: cdns,ddr-edac: add Cadence DDR EDAC Paul Louvel
2026-11-18 10:05 ` [PATCH v8 2/3] EDAC/cadence: Add Cadence DDR EDAC driver Paul Louvel
2026-11-20 11:19 ` Wolfram Sang [this message]
2026-11-18 10:05 ` [PATCH v8 3/3] ARM: dts: renesas: r9a06g032: add EDAC node Paul Louvel
2026-11-18 10:27 ` Wolfram Sang
2026-11-18 10:25 ` [PATCH v8 0/3] Add Renesas RZ/N1x EDAC driver Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awAs386mgR23nmJ2@ninjato \
--to=wsa+renesas@sang-engineering.com \
--cc=bp@alien8.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=herve.codina@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=paul.louvel@bootlin.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox