Commit 6c44e535 authored by Yazen Ghannam's avatar Yazen Ghannam Committed by Borislav Petkov (AMD)
Browse files

RAS/AMD/ATL: Include row[13] bit in row retirement



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: 3b566b30 ("RAS/AMD/ATL: Add MI300 row retirement support")
Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: default avatarBorislav 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
parent 0af2f6be
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -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)