]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RAS/AMD/ATL: Include row[13] bit in row retirement
authorYazen Ghannam <yazen.ghannam@amd.com>
Tue, 1 Apr 2025 20:49:00 +0000 (20:49 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 7 Apr 2025 13:06:06 +0000 (15:06 +0200)
Based on feedback from hardware folks, row[13] is part of the variable
bits within a physical row (along with all column bits).

Only half the physical addresses affected by a row are calculated if
this bit is not included.

Add the row[13] bit to the row retirement flow.

Fixes: 3b566b30b414 ("RAS/AMD/ATL: Add MI300 row retirement support")
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250401-fix-fmpm-extra-records-v1-1-840bcf7a8ac5@amd.com
drivers/ras/amd/atl/umc.c

index dc8aa12f63c8118d6b60c242ae0665f91431f2c3..cb8ace3d4e42d0c9e0eeccc4024829dcb30cd745 100644 (file)
@@ -320,7 +320,7 @@ static unsigned long convert_dram_to_norm_addr_mi300(unsigned long addr)
  * See amd_atl::convert_dram_to_norm_addr_mi300() for MI300 address formats.
  */
 #define MI300_NUM_COL          BIT(HWEIGHT(MI300_UMC_MCA_COL))
-static void retire_row_mi300(struct atl_err *a_err)
+static void _retire_row_mi300(struct atl_err *a_err)
 {
        unsigned long addr;
        struct page *p;
@@ -351,6 +351,23 @@ static void retire_row_mi300(struct atl_err *a_err)
        }
 }
 
+/*
+ * In addition to the column bits, the row[13] bit should also be included when
+ * calculating addresses affected by a physical row.
+ *
+ * Instead of running through another loop over a single bit, just run through
+ * the column bits twice and flip the row[13] bit in-between.
+ *
+ * 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);
+       a_err->addr ^= MI300_UMC_MCA_ROW13;
+       _retire_row_mi300(a_err);
+}
+
 void amd_retire_dram_row(struct atl_err *a_err)
 {
        if (df_cfg.rev == DF4p5 && df_cfg.flags.heterogeneous)