[PATCH 2/4] EDAC/amd64: Detect LPDDR5 memory
From: Yazen Ghannam
Date: Fri Dec 04 2026 - 11:31:07 EST
Systems using LPDDR5 memory are reported as having DDR4.
Rework the memory type decoding to recognize LPDDR5.
Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---
drivers/edac/amd64_edac.c | 14 ++++++++------
drivers/edac/amd64_edac.h | 5 +++++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index a8e76a79833b..2c11ca2d0696 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1550,7 +1550,7 @@ static void dct_read_base_mask(struct amd64_pvt *pvt)
static void umc_determine_memory_type(struct amd64_pvt *pvt)
{
struct amd64_umc *umc;
- u32 i;
+ u32 ddr_type, i;
for_each_umc(i) {
umc = &pvt->umc[i];
@@ -1560,11 +1560,13 @@ static void umc_determine_memory_type(struct amd64_pvt *pvt)
continue;
}
- /*
- * Check if the system supports the "DDR Type" field in UMC Config
- * and has DDR5 DIMMs in use.
- */
- if (pvt->flags.zn_regs_v2 && ((umc->umc_cfg & GENMASK(2, 0)) == 0x1)) {
+ /* Older systems encode DdrType differently. */
+ ddr_type = pvt->flags.zn_regs_v2 ?
+ FIELD_GET(UMC_CFG_DDR_TYPE, umc->umc_cfg) : 0;
+
+ if (ddr_type == UMC_CFG_DDR_TYPE_LPDDR5) {
+ umc->dram_type = MEM_LPDDR5;
+ } else if (ddr_type == UMC_CFG_DDR_TYPE_DDR5) {
if (umc->dimm_cfg & BIT(5))
umc->dram_type = MEM_LRDDR5;
else if (umc->dimm_cfg & BIT(4))
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 2c6b0429916e..f0be0fced65b 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -270,6 +270,11 @@
#define UMC_SDP_INIT BIT(31)
+/* UMC::UmcConfig[DdrType] */
+#define UMC_CFG_DDR_TYPE GENMASK(2, 0)
+#define UMC_CFG_DDR_TYPE_DDR5 0x1
+#define UMC_CFG_DDR_TYPE_LPDDR5 0x6
+
/* Error injection control structure */
struct error_injection {
u32 section;
--
2.55.0