Skip to content

Commit 32a0dc9

Browse files
committed
EDAC/amd64: Simplify ECC check on unified memory controllers
JIRA: https://issues.redhat.com/browse/RHEL-73049 Tested: by me commit 7473673 Author: Borislav Petkov (AMD) <[email protected]> Date: Wed Dec 11 12:07:42 2024 +0100 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 <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Tested-by: Avadhut Naik <[email protected]> Reviewed-by: Avadhut Naik <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Aristeu Rozanski <[email protected]>
1 parent 24b0cb8 commit 32a0dc9

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
@@ -3363,36 +3363,24 @@ static bool dct_ecc_enabled(struct amd64_pvt *pvt)
33633363

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

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

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

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

3392-
if (!ecc_en)
3393-
return false;
3394-
else
3395-
return true;
3383+
return ecc_en;
33963384
}
33973385

33983386
static inline void

0 commit comments

Comments
 (0)