linux-kernelorg-stable/drivers/edac
Avadhut Naik a3f3040657 EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
Each Chip-Select (CS) of a Unified Memory Controller (UMC) on AMD Zen-based
SOCs has an Address Mask and a Secondary Address Mask register associated with
it. The amd64_edac module logs DIMM sizes on a per-UMC per-CS granularity
during init using these two registers.

Currently, the module primarily considers only the Address Mask register for
computing DIMM sizes. The Secondary Address Mask register is only considered
for odd CS. Additionally, if it has been considered, the Address Mask register
is ignored altogether for that CS. For power-of-two DIMMs i.e. DIMMs whose
total capacity is a power of two (32GB, 64GB, etc), this is not an issue
since only the Address Mask register is used.

For non-power-of-two DIMMs i.e., DIMMs whose total capacity is not a power of
two (48GB, 96GB, etc), however, the Secondary Address Mask register is used
in conjunction with the Address Mask register. However, since the module only
considers either of the two registers for a CS, the size computed by the
module is incorrect. The Secondary Address Mask register is not considered for
even CS, and the Address Mask register is not considered for odd CS.

Introduce a new helper function so that both Address Mask and Secondary
Address Mask registers are considered, when valid, for computing DIMM sizes.
Furthermore, also rename some variables for greater clarity.

Fixes: 81f5090db8 ("EDAC/amd64: Support asymmetric dual-rank DIMMs")
Closes: https://lore.kernel.org/dbec22b6-00f2-498b-b70d-ab6f8a5ec87e@natrix.lt
Reported-by: Žilvinas Žaltiena <zilvinas@natrix.lt>
Signed-off-by: Avadhut Naik <avadhut.naik@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Tested-by: Žilvinas Žaltiena <zilvinas@natrix.lt>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/20250529205013.403450-1-avadhut.naik@amd.com
2025-06-25 16:40:03 +02:00
..
Kconfig Merge remote-tracking branches 'ras/edac-cxl', 'ras/edac-drivers' and 'ras/edac-misc' into edac-updates 2025-03-25 14:53:27 +01:00
Makefile EDAC: Add a memory repair control feature 2025-02-26 11:13:23 +01:00
al_mc_edac.c
altera_edac.c EDAC/altera: Use correct write width with the INTTEST register 2025-05-29 17:38:55 +02:00
altera_edac.h EDAC/altera: Set DDR and SDMMC interrupt mask before registration 2025-04-28 12:38:53 +02:00
amd64_edac.c EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs 2025-06-25 16:40:03 +02:00
amd64_edac.h
amd76x_edac.c
armada_xp_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
aspeed_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
bluefield_edac.c EDAC/bluefield: Don't use bluefield_edac_readl() result on error 2025-05-22 17:58:28 +02:00
cpc925_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
debugfs.c EDAC: Use string choice helper functions 2025-02-25 22:19:55 +01:00
dmc520_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
e7xxx_edac.c
e752x_edac.c
ecs.c EDAC: Add a Error Check Scrub control feature 2025-02-25 15:42:32 +01:00
edac_device.c EDAC/device: Fix dev_set_name() format string 2025-03-05 23:35:01 +01:00
edac_device.h
edac_device_sysfs.c
edac_mc.c EDAC: Fix typos in comments 2024-12-15 22:17:34 +01:00
edac_mc.h
edac_mc_sysfs.c EDAC: Fix typos in comments 2024-12-15 22:17:34 +01:00
edac_module.c
edac_module.h
edac_pci.c
edac_pci.h
edac_pci_sysfs.c
fsl_ddr_edac.c
fsl_ddr_edac.h
ghes_edac.c
highbank_l2_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
highbank_mc_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
i7core_edac.c
i10nm_base.c EDAC/i10nm: Fix the bitwise operation between variables of different sizes 2025-04-24 08:42:25 -07:00
i3000_edac.c
i3200_edac.c
i5000_edac.c EDAC: Fix typos in comments 2024-12-15 22:17:34 +01:00
i5100_edac.c
i5400_edac.c EDAC: Use string choice helper functions 2025-02-25 22:19:55 +01:00
i7300_edac.c EDAC: Use string choice helper functions 2025-02-25 22:19:55 +01:00
i82443bxgx_edac.c
i82860_edac.c
i82875p_edac.c
i82975x_edac.c
ie31200_edac.c - ie31200: Add support for Raptor Lake-S and Alder Lake-S compute dies 2025-05-27 10:13:06 -07:00
igen6_edac.c EDAC/igen6: Fix NULL pointer dereference 2025-06-18 20:19:45 +02:00
layerscape_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
loongson_edac.c EDAC: Add an EDAC driver for the Loongson memory controller 2025-01-04 12:02:04 +01:00
mce_amd.c x86/msr: Add explicit includes of <asm/msr.h> 2025-05-02 10:23:47 +02:00
mce_amd.h
mem_repair.c cxl/edac: Add CXL memory device memory sparing control feature 2025-05-23 13:24:53 -07:00
mpc85xx_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
mpc85xx_edac.h
npcm_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
octeon_edac-l2c.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
octeon_edac-lmc.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
octeon_edac-pc.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
octeon_edac-pci.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
pasemi_edac.c
pnd2_edac.c EDAC/pnd2: Make read-only const array intlv static 2025-03-03 16:39:26 +01:00
pnd2_edac.h
qcom_edac.c EDAC/qcom: Correct interrupt enable register configuration 2025-02-14 20:36:11 +01:00
r82600_edac.c
sb_edac.c
scrub.c EDAC: Add scrub control feature 2025-02-25 15:39:09 +01:00
sifive_edac.c
skx_base.c - Remove the less generic CPU matching infra around struct x86_cpu_desc and 2025-01-21 09:30:59 -08:00
skx_common.c EDAC/skx_common: Fix general protection fault 2025-04-17 10:19:02 -07:00
skx_common.h EDAC/{skx_common,i10nm}: Add RRL support for Intel Granite Rapids server 2025-04-17 10:45:21 -07:00
synopsys_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
thunderx_edac.c
ti_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
versal_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
wq.c
x38_edac.c
xgene_edac.c EDAC: Use string choice helper functions 2025-02-25 22:19:55 +01:00
zynqmp_edac.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00