[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250401-fix-fmpm-extra-records-v1-2-840bcf7a8ac5@amd.com>
Date: Tue, 1 Apr 2025 20:49:01 +0000
From: Yazen Ghannam <yazen.ghannam@....com>
To: Yazen Ghannam <Yazen.Ghannam@....com>, Borislav Petkov <bp@...en8.de>,
Naveen Krishna Chatradhi <naveenkrishna.chatradhi@....com>, Muralidhara M K
<muralidhara.mk@....com>
CC: <linux-edac@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "Yazen
Ghannam" <yazen.ghannam@....com>
Subject: [PATCH 2/2] RAS/AMD/{ATL,FMPM}: Get masked address
Some operations require checking, or ignoring, specific bits in an
address value. For example, this can be comparing address values to
identify unique structures.
Currently, the full address value is compared when filtering for
duplicates. This results in over counting and creation of extra records.
This gives the impression that more unique events occurred than did in
reality.
Introduce a helper to return a masked address. Do this in the AMD
Address Translation Library, since the bits depend on particular
structures and are implementation-specific.
Start with the case for physical rows on MI300.
Fixes: 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Signed-off-by: Yazen Ghannam <yazen.ghannam@....com>
Cc: stable@...r.kernel.org
---
drivers/ras/amd/atl/umc.c | 14 ++++++++++++++
drivers/ras/amd/fmpm.c | 2 +-
include/linux/ras.h | 2 ++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/ras/amd/atl/umc.c b/drivers/ras/amd/atl/umc.c
index cb8ace3d4e42..0b6e5305ea83 100644
--- a/drivers/ras/amd/atl/umc.c
+++ b/drivers/ras/amd/atl/umc.c
@@ -375,6 +375,20 @@ void amd_retire_dram_row(struct atl_err *a_err)
}
EXPORT_SYMBOL_GPL(amd_retire_dram_row);
+u64 amd_atl_masked_addr(u64 addr)
+{
+ /*
+ * Row retirement is done on MI300 systems, and some bits are 'don't care'
+ * for comparing addresses with unique physical rows.
+ * This includes all column bits and the row[13] bit.
+ */
+ if (df_cfg.rev == DF4p5 && df_cfg.flags.heterogeneous)
+ return addr & ~(MI300_UMC_MCA_ROW13 | MI300_UMC_MCA_COL);
+
+ return addr;
+}
+EXPORT_SYMBOL_GPL(amd_atl_masked_addr);
+
static unsigned long get_addr(unsigned long addr)
{
if (df_cfg.rev == DF4p5 && df_cfg.flags.heterogeneous)
diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 90de737fbc90..2ca789d7c8ec 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -258,7 +258,7 @@ static bool fpds_equal(struct cper_fru_poison_desc *old, struct cper_fru_poison_
*
* Also, order the checks from most->least likely to fail to shortcut the code.
*/
- if (old->addr != new->addr)
+ if (amd_atl_masked_addr(old->addr) != amd_atl_masked_addr(new->addr))
return false;
if (old->hw_id != new->hw_id)
diff --git a/include/linux/ras.h b/include/linux/ras.h
index a64182bc72ad..e822275bed6a 100644
--- a/include/linux/ras.h
+++ b/include/linux/ras.h
@@ -46,9 +46,11 @@ struct atl_err {
void amd_atl_register_decoder(unsigned long (*f)(struct atl_err *));
void amd_atl_unregister_decoder(void);
void amd_retire_dram_row(struct atl_err *err);
+u64 amd_atl_masked_addr(u64 addr);
unsigned long amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err);
#else
static inline void amd_retire_dram_row(struct atl_err *err) { }
+static inline u64 amd_atl_masked_addr(u64 addr) { return addr; }
static inline unsigned long
amd_convert_umc_mca_addr_to_sys_addr(struct atl_err *err) { return -EINVAL; }
#endif /* CONFIG_AMD_ATL */
--
2.49.0
Powered by blists - more mailing lists