From c448edda952cfc4a56e2796a9bc9ba22c4be65a1 Mon Sep 17 00:00:00 2001 From: Liao Xuan Date: Thu, 13 Mar 2025 23:06:16 -0400 Subject: [PATCH 1/2] anolis: EDAC/amd64: Fix the calculation of instance id for Hygon family 18h model 6h ANBZ: #19127 On Hygon family 18h model 6h platform, each DDR has two subchannels, and each subchannel has a mca bank with a cs corresponded. In the process of address translation, it needs to know the instance id of cs to access df register correctly. The instance id of cs can be calculated from IPID[23:20] and IPID[13]: IPID[23:20] represents which umc controller it belongs to, and IPID[13] represents which subchannel it is. Fixes: 54ab9ebb1146 ("anolis: EDAC/amd64: Adjust UMC channel for Hygon family 18h model 6h") Signed-off-by: Liao Xuan --- drivers/edac/amd64_edac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 03553ceaf12e..5be5072dfb83 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2758,8 +2758,8 @@ static void decode_umc_error(int node_id, struct mce *m) err.csrow = m->synd & 0x7; - if (hygon_f18h_m4h() && boot_cpu_data.x86_model == 0x6) - umc = err.channel << 1; + if (hygon_f18h_m4h() && boot_cpu_data.x86_model >= 0x6) + umc = (err.channel << 1) + ((m->ipid & BIT(13)) >> 13); else umc = err.channel; -- Gitee From b47d86ece94115954f4ccf671c250dd810f78160 Mon Sep 17 00:00:00 2001 From: Liao Xuan Date: Thu, 13 Mar 2025 23:07:48 -0400 Subject: [PATCH 2/2] anolis: EDAC/amd64: Get instance id for Hygon family 18h model 10h ANBZ: #19127 The instance id for Hygon family 18h model 10h is also get from IPID[23:20] and IPID[13]. Signed-off-by: Liao Xuan --- drivers/edac/amd64_edac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 5be5072dfb83..4903a0a5a0a3 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2758,7 +2758,8 @@ static void decode_umc_error(int node_id, struct mce *m) err.csrow = m->synd & 0x7; - if (hygon_f18h_m4h() && boot_cpu_data.x86_model >= 0x6) + if ((hygon_f18h_m4h() && boot_cpu_data.x86_model >= 0x6) || + hygon_f18h_m10h()) umc = (err.channel << 1) + ((m->ipid & BIT(13)) >> 13); else umc = err.channel; -- Gitee