Re: [PATCH v8 2/3] EDAC/cadence: Add Cadence DDR EDAC driver
From: Paul Louvel
Date: Fri Nov 20 2026 - 10:42:18 EST
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