linux-yocto/drivers/edac
Avadhut Naik 8ed96d8e05 EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs
commit a3f3040657 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-06 11:01:42 +02:00
..
al_mc_edac.c
altera_edac.c EDAC/altera: Use correct write width with the INTTEST register 2025-06-27 11:11:21 +01:00
altera_edac.h EDAC/altera: Set DDR and SDMMC interrupt mask before registration 2025-05-09 09:50:30 +02:00
amd64_edac.c EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs 2025-07-06 11:01:42 +02:00
amd64_edac.h EDAC/amd64: Remove unused register accesses 2024-06-12 11:33:45 +02:00
amd76x_edac.c
amd8111_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
amd8111_edac.h
amd8131_edac.c
amd8131_edac.h
armada_xp_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
aspeed_edac.c
bluefield_edac.c EDAC/bluefield: Fix potential integer overflow 2024-12-05 14:01:16 +01:00
cell_edac.c
cpc925_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
debugfs.c
dmc520_edac.c EDAC/dmc520: Use devm_platform_ioremap_resource() 2024-06-23 10:48:55 +02:00
e7xxx_edac.c
e752x_edac.c
edac_device_sysfs.c EDAC/device: Remove edac_dev_sysfs_block_attribute::store() 2024-03-27 18:26:57 +01:00
edac_device.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
edac_device.h EDAC: Remove unused struct members 2024-03-27 18:26:58 +01:00
edac_mc_sysfs.c EDAC/mc_sysfs: Convert sprintf()/snprintf() to sysfs_emit() 2024-04-04 18:23:57 +02:00
edac_mc.c
edac_mc.h
edac_module.c
edac_module.h
edac_pci_sysfs.c Driver core changes for 6.8-rc1 2024-01-18 09:48:40 -08:00
edac_pci.c
edac_pci.h EDAC: Remove unused struct members 2024-03-27 18:26:58 +01:00
fsl_ddr_edac.c EDAC/fsl_ddr: Fix bad bit shift operations 2024-12-05 14:01:17 +01:00
fsl_ddr_edac.h
ghes_edac.c EDAC/ghes: Add missing newline to pr_info() statement 2024-05-28 16:13:09 +02:00
highbank_l2_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
highbank_mc_edac.c
i7core_edac.c
i10nm_base.c EDAC/{skx_common,i10nm}: Fix the loss of saved RRL for HBM pseudo channel 0 2025-06-19 15:31:31 +02:00
i3000_edac.c
i3200_edac.c
i5000_edac.c
i5100_edac.c
i5400_edac.c
i7300_edac.c
i82443bxgx_edac.c
i82860_edac.c
i82875p_edac.c
i82975x_edac.c
ie31200_edac.c EDAC/ie31200: work around false positive build warning 2025-05-29 11:02:43 +02:00
igen6_edac.c EDAC/igen6: Avoid segmentation fault on module unload 2024-12-05 14:01:18 +01:00
Kconfig EDAC: Drop obsolete PPC4xx driver 2024-09-05 16:56:38 +02:00
layerscape_edac.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
Makefile EDAC: Drop obsolete PPC4xx driver 2024-09-05 16:56:38 +02:00
mce_amd.c x86/cpu/amd: Provide a separate accessor for Node ID 2024-02-15 22:07:37 +01:00
mce_amd.h
mpc85xx_edac.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
mpc85xx_edac.h
npcm_edac.c
octeon_edac-l2c.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
octeon_edac-lmc.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
octeon_edac-pc.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
octeon_edac-pci.c EDAC: Add missing MODULE_DESCRIPTION() macros 2024-06-29 16:21:01 +02:00
pasemi_edac.c
pnd2_edac.c EDAC, pnd2: Switch to new Intel CPU model defines 2024-05-28 16:03:43 -07:00
pnd2_edac.h
qcom_edac.c EDAC/qcom: Correct interrupt enable register configuration 2025-02-27 04:30:23 -08:00
r82600_edac.c
sb_edac.c EDAC/sb_edac: Fix the compile warning of large frame size 2024-09-03 15:09:22 -07:00
sifive_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
skx_base.c EDAC/{skx_common,skx,i10nm}: Move the common debug code to skx_common 2024-09-03 12:35:06 -07:00
skx_common.c EDAC/skx_common: Fix general protection fault 2025-06-19 15:31:31 +02:00
skx_common.h EDAC/{skx_common,i10nm}: Fix the loss of saved RRL for HBM pseudo channel 0 2025-06-19 15:31:31 +02:00
synopsys_edac.c EDAC/synopsys: Fix error injection on Zynq UltraScale+ 2024-08-01 16:27:46 +02:00
thunderx_edac.c EDAC/thunderx: Remove unused struct error_syndrome 2024-05-27 14:42:04 +02:00
ti_edac.c
versal_edac.c EDAC/versal: Do not log total error counts 2024-04-25 18:08:05 +02:00
wq.c
x38_edac.c
xgene_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00
zynqmp_edac.c EDAC: Remove dynamic attributes from edac_device_alloc_ctl_info() 2024-03-27 18:26:58 +01:00