From 54ac9418146386fdd72ecf06a2a8c376d0e1fe3b Mon Sep 17 00:00:00 2001 From: Wenhui Fan Date: Tue, 18 Feb 2025 11:24:18 +0800 Subject: [PATCH 1/3] EDAC/amd64: Fix the calculation of instance id for Hygon family 18h model 6h hygon inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBN075 CVE: NA --------------------------- 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: d0d1ed37697f ("EDAC/amd64: Adjust UMC channel for Hygon family 18h model 6h") Signed-off-by: Wenhui Fan --- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 8d9f41006287..1f5992b47638 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2779,7 +2779,7 @@ 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; + umc = (err.channel << 1) + ((m->ipid & BIT(13)) >> 13); else umc = err.channel; -- Gitee From b5cbb784d682bd6ef1a882e471e4123c4d6a9b57 Mon Sep 17 00:00:00 2001 From: Wenhui Fan Date: Tue, 18 Feb 2025 14:42:20 +0800 Subject: [PATCH 2/3] EDAC/amd64: Calculate instance id for hygon family 18h model 7h hygon inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IBN1FG CVE: NA --------------------------- The instance id for Hygon family 18h model 7h and 10h is also get from IPID[23:20] and IPID[13]. Signed-off-by: Wenhui Fan --- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 1f5992b47638..9b17fcb4e104 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2778,7 +2778,7 @@ 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) umc = (err.channel << 1) + ((m->ipid & BIT(13)) >> 13); else umc = err.channel; -- Gitee From c239bd1ea73bd6cb7c5d388fc08132c595d753cf Mon Sep 17 00:00:00 2001 From: Wenhui Fan Date: Tue, 18 Feb 2025 16:26:44 +0800 Subject: [PATCH 3/3] EDAC/amd64: Get instance id for Hygon family 18h model 10h hygon inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IBN2NP CVE: NA --------------------------- The instance id for Hygon family 18h model 10h is also get from IPID[23:20] and IPID[13]. Signed-off-by: Wenhui Fan --- 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 9b17fcb4e104..eeb8de51605c 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2778,7 +2778,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