]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RAS/AMD/FMPM: Get masked address
authorYazen Ghannam <yazen.ghannam@amd.com>
Thu, 27 Feb 2025 19:31:32 +0000 (19:31 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:47:56 +0000 (10:47 +0200)
commit 58029c39cdc54ac4f4dc40b4a9c05eed9f9b808a upstream.

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.

Mask the address for physical rows on MI300.

  [ bp: Simplify. ]

Fixes: 6f15e617cc99 ("RAS: Introduce a FRU memory poison manager")
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ras/amd/atl/internal.h
drivers/ras/amd/atl/umc.c
drivers/ras/amd/fmpm.c

index 143d04c779a821fb52a1e186cea3b265204c8b3e..b7c7d5ba4d9dd1762b414ce66fc0ba8b1b533334 100644 (file)
@@ -361,4 +361,7 @@ static inline void atl_debug_on_bad_intlv_mode(struct addr_ctx *ctx)
        atl_debug(ctx, "Unrecognized interleave mode: %u", ctx->map.intlv_mode);
 }
 
+#define MI300_UMC_MCA_COL      GENMASK(5, 1)
+#define MI300_UMC_MCA_ROW13    BIT(23)
+
 #endif /* __AMD_ATL_INTERNAL_H__ */
index cb8ace3d4e42d0c9e0eeccc4024829dcb30cd745..6e072b7667e98b73956413acbc85e75db1f4ddc2 100644 (file)
@@ -229,7 +229,6 @@ int get_umc_info_mi300(void)
  * Additionally, the PC and Bank bits may be hashed. This must be accounted for before
  * reconstructing the normalized address.
  */
-#define MI300_UMC_MCA_COL      GENMASK(5, 1)
 #define MI300_UMC_MCA_BANK     GENMASK(9, 6)
 #define MI300_UMC_MCA_ROW      GENMASK(24, 10)
 #define MI300_UMC_MCA_PC       BIT(25)
@@ -360,7 +359,6 @@ static void _retire_row_mi300(struct atl_err *a_err)
  *
  * See MI300_UMC_MCA_ROW for the row bits in MCA_ADDR_UMC value.
  */
-#define MI300_UMC_MCA_ROW13    BIT(23)
 static void retire_row_mi300(struct atl_err *a_err)
 {
        _retire_row_mi300(a_err);
index 90de737fbc909780581068c82eff4ecfb291b7fb..8877c6ff64c468730c2fc4a05e09634ae0ba36a1 100644 (file)
@@ -250,6 +250,13 @@ static bool rec_has_valid_entries(struct fru_rec *rec)
        return true;
 }
 
+/*
+ * 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.
+ */
+#define MASK_ADDR(addr)        ((addr) & ~(MI300_UMC_MCA_ROW13 | MI300_UMC_MCA_COL))
+
 static bool fpds_equal(struct cper_fru_poison_desc *old, struct cper_fru_poison_desc *new)
 {
        /*
@@ -258,7 +265,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 (MASK_ADDR(old->addr) != MASK_ADDR(new->addr))
                return false;
 
        if (old->hw_id != new->hw_id)