The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Paul Louvel" <paul.louvel@bootlin.com>
To: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"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 16:42:03 +0100	[thread overview]
Message-ID: <DN05I5YO7GJP.2JUFMLWXFSOG7@bootlin.com> (raw)
In-Reply-To: <awAs386mgR23nmJ2@ninjato>

Hi Wolfram,

On Fri Nov 20, 2026 at 12:19 PM CET, Wolfram Sang wrote:
>> 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()
>> --
>> [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.

This is correct.

The datasheet says: "Address of correctable / uncorrectable ECC event" for these
registers, but DRAM is mapped at 0x80000000.

>> [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.

Good point. dimm->edac_mode should be set to EDAC_NONE when ECC is disabled. So
that when ECC is disabled:

# cat /sys/bus/edac/devices/mc/mc0/rank0/dimm_*
0
x16
None
Channel#0_DIMM#0
csrow 0 channel 0 
Unbuffered-DDR3
0

Instead of:

0
x16
SECDED
Channel#0_DIMM#0
csrow 0 channel 0 
Unbuffered-DDR3
0

I don't think failing the probe is a good idea, but it should not expose debugfs
error injection for sure.

These issues will be fixed.

Thanks.
Best regards,
-- 
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2026-11-20 15:42 UTC|newest]

Thread overview: 8+ 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
2026-11-20 15:42     ` Paul Louvel [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=DN05I5YO7GJP.2JUFMLWXFSOG7@bootlin.com \
    --to=paul.louvel@bootlin.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=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tony.luck@intel.com \
    --cc=wsa+renesas@sang-engineering.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