[PATCH Intenal 2/2] EDAC/amd64: Limit UMC csrow decode to the implemented chip selects
From: Vishal Badole
Date: Wed Sep 23 2026 - 07:26:52 EST
For DRAM ECC errors on SMCA systems, the Chip Select which reported the
error is encoded in the MCA_SYND[ErrorInformation] field. The EDAC core
uses that value to index into the csrow array which was sized during
probe from pvt->csels[].b_cnt.
On Family 1Ah Model 88h a corrected DRAM error results in:
EDAC MC0: INTERNAL ERROR: csrow value is out of range (5 >= 4)
WARNING: drivers/edac/edac_mc.c:919 at edac_raw_mc_handle_error
and the error is subsequently reported against "unknown memory", so the
DIMM which actually reported the error cannot be identified.
This happens because the syndrome field is masked with a hardcoded 0x7,
i.e. eight possible chip selects, while umc_prep_chip_selects() sizes
every UMC channel for four. Bit 2 of that field is therefore not a valid
Chip Select bit, and whenever hardware leaves it set the decoded value
exceeds the number of csrows the EDAC core knows about.
Mask with the number of chip selects the controller actually implements
so the decoded value can never exceed what was allocated, instead of
relying on an assumption about the field width that no longer holds.
Signed-off-by: Vishal Badole <Vishal.Badole@xxxxxxx>
---
drivers/edac/amd64_edac.c | 13 +++++++------
drivers/edac/amd64_edac.h | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index ff0ebc8e15f6..f6f9b8e63234 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2796,13 +2796,14 @@ static inline void decode_bus_error(int node_id, struct mce *m)
* the instance_id. For example, instance_id=0xYXXXXX where Y is the channel
* number.
*
- * For DRAM ECC errors, the Chip Select number is given in bits [2:0] of
- * the MCA_SYND[ErrorInformation] field.
+ * For DRAM ECC errors, the Chip Select number is given in the low bits of
+ * the MCA_SYND[ErrorInformation] field. Only as many bits as the UMC has
+ * implemented chip selects are valid there.
*/
-static void umc_get_err_info(struct mce *m, struct err_info *err)
+static void umc_get_err_info(struct amd64_pvt *pvt, struct mce *m, struct err_info *err)
{
err->channel = (m->ipid & GENMASK(31, 0)) >> 20;
- err->csrow = m->synd & 0x7;
+ err->csrow = m->synd & (pvt->csels[0].b_cnt - 1);
}
static void decode_umc_error(int node_id, struct mce *m)
@@ -2841,7 +2842,7 @@ static void decode_umc_error(int node_id, struct mce *m)
err.err_code = ERR_CHANNEL;
}
- pvt->ops->get_err_info(m, &err);
+ pvt->ops->get_err_info(pvt, m, &err);
a_err.addr = m->addr;
a_err.ipid = m->ipid;
@@ -3514,7 +3515,7 @@ static int umc_hw_info_get(struct amd64_pvt *pvt)
* UMC1 CH[3:0] = 0x0025[3:0]000
* UMC1 CH[7:4] = 0x0035[3:0]000
*/
-static void gpu_get_err_info(struct mce *m, struct err_info *err)
+static void gpu_get_err_info(struct amd64_pvt *pvt, struct mce *m, struct err_info *err)
{
u8 ch = (m->ipid & GENMASK(31, 0)) >> 20;
u8 phy = ((m->ipid >> 12) & 0xf);
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 1757c1b99fc8..9a8b7e296087 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -467,7 +467,7 @@ struct low_ops {
bool (*ecc_enabled)(struct amd64_pvt *pvt);
void (*setup_mci_misc_attrs)(struct mem_ctl_info *mci);
void (*dump_misc_regs)(struct amd64_pvt *pvt);
- void (*get_err_info)(struct mce *m, struct err_info *err);
+ void (*get_err_info)(struct amd64_pvt *pvt, struct mce *m, struct err_info *err);
};
int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,
--
2.34.1