Skip to content

Commit 7473673

Browse files
committed
EDAC/amd64: Simplify ECC check on unified memory controllers
The intent of the check is to see whether at least one UMC has ECC enabled. So do that instead of tracking which ones are enabled in masks which are too small in size anyway and lead to not loading the driver on Zen4 machines with UMCs enabled over UMC8. Fixes: e2be595 ("EDAC/amd64: Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh") Reported-by: Avadhut Naik <avadhut.naik@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Avadhut Naik <avadhut.naik@amd.com> Reviewed-by: Avadhut Naik <avadhut.naik@amd.com> Cc: <stable@kernel.org> Link: https://lore.kernel.org/r/20241210212054.3895697-1-avadhut.naik@amd.com
1 parent fac04ef commit 7473673

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

drivers/edac/amd64_edac.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,36 +3362,24 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt)
33623362

33633363
static bool umc_ecc_enabled(struct amd64_pvt *pvt)
33643364
{
3365-
u8 umc_en_mask = 0, ecc_en_mask = 0;
3366-
u16 nid = pvt->mc_node_id;
33673365
struct amd64_umc *umc;
3368-
u8 ecc_en = 0, i;
3366+
bool ecc_en = false;
3367+
int i;
33693368

3369+
/* Check whether at least one UMC is enabled: */
33703370
for_each_umc(i) {
33713371
umc = &pvt->umc[i];
33723372

3373-
/* Only check enabled UMCs. */
3374-
if (!(umc->sdp_ctrl & UMC_SDP_INIT))
3375-
continue;
3376-
3377-
umc_en_mask |= BIT(i);
3378-
3379-
if (umc->umc_cap_hi & UMC_ECC_ENABLED)
3380-
ecc_en_mask |= BIT(i);
3373+
if (umc->sdp_ctrl & UMC_SDP_INIT &&
3374+
umc->umc_cap_hi & UMC_ECC_ENABLED) {
3375+
ecc_en = true;
3376+
break;
3377+
}
33813378
}
33823379

3383-
/* Check whether at least one UMC is enabled: */
3384-
if (umc_en_mask)
3385-
ecc_en = umc_en_mask == ecc_en_mask;
3386-
else
3387-
edac_dbg(0, "Node %d: No enabled UMCs.\n", nid);
3388-
3389-
edac_dbg(3, "Node %d: DRAM ECC %s.\n", nid, (ecc_en ? "enabled" : "disabled"));
3380+
edac_dbg(3, "Node %d: DRAM ECC %s.\n", pvt->mc_node_id, (ecc_en ? "enabled" : "disabled"));
33903381

3391-
if (!ecc_en)
3392-
return false;
3393-
else
3394-
return true;
3382+
return ecc_en;
33953383
}
33963384

33973385
static inline void

0 commit comments

Comments
 (0)