From: Muralidhara M K <muralimk@amd.com>
To: <linux-edac@vger.kernel.org>, <x86@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <bp@alien8.de>,
<mchehab@kernel.org>, Muralidhara M K <muralidhara.mk@amd.com>
Subject: [PATCH 4/7] RAS: Add static lookup table to get CS physical ID
Date: Wed, 25 Oct 2023 07:33:36 +0000 [thread overview]
Message-ID: <20231025073339.630093-5-muralimk@amd.com> (raw)
In-Reply-To: <20231025073339.630093-1-muralimk@amd.com>
From: Muralidhara M K <muralidhara.mk@amd.com>
AMD MI300A models have a single Data Fabric (DF) instance per socket.
So, all 4 AIDs are not software-visible (using PCI Device 18h, etc.).
The MCA_IPID_UMC[InstanceId] field holds the SMN base address for the
UMC instance and SMN address mapping repeated same for each of all 4
AIDs in as socket.
Add a static lookup table by reading the UMC SMN address from the
MCA_IPID_UMC[InstanceId] field and use the value to look up the
CS physical ID from the table.
Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
---
drivers/ras/amd/atl/umc.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/ras/amd/atl/umc.c b/drivers/ras/amd/atl/umc.c
index fa8c3072a54f..52247a7949fb 100644
--- a/drivers/ras/amd/atl/umc.c
+++ b/drivers/ras/amd/atl/umc.c
@@ -153,6 +153,35 @@ static int umc_ondie_addr_to_normaddr(u64 mca_addr, u16 nid)
return mca_addr;
}
+/*
+ * MCA_IPID_UMC[InstanceId] holds the SMN Base Address for a UMC instance.
+ * MI-300 has a fixed, model-specific mapping between a UMC instance and its
+ * related Data Fabric CS instance.
+ * Use the UMC SMN Base Address value to find the appropriate CS instance ID.
+ */
+static const u32 csmap[32] = {
+ 0x393f00, 0x293f00, 0x193f00, 0x093f00, 0x392f00, 0x292f00,
+ 0x192f00, 0x092f00, 0x391f00, 0x291f00, 0x191f00, 0x091f00,
+ 0x390f00, 0x290f00, 0x190f00, 0x090f00, 0x793f00, 0x693f00,
+ 0x593f00, 0x493f00, 0x792f00, 0x692f00, 0x592f00, 0x492f00,
+ 0x791f00, 0x691f00, 0x591f00, 0x491f00, 0x790f00, 0x690f00,
+ 0x590f00, 0x490f00 };
+
+/* MCA_IPID[InstanceId] give the Instance Number UMC SmnAddr */
+#define UMC_PHY_INSTANCE_NUM GENMASK(31, 0)
+
+static u8 fixup_cs_inst_id(struct mce *m)
+{
+ u32 smn_addr = FIELD_GET(UMC_PHY_INSTANCE_NUM, m->ipid);
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(csmap); i++) {
+ if (smn_addr == csmap[i])
+ break;
+ }
+ return i;
+}
+
static u8 get_socket_id(struct mce *m)
{
return m->socketid;
@@ -187,6 +216,10 @@ static u64 get_norm_addr(struct mce *m)
#define UMC_CHANNEL_NUM GENMASK(31, 20)
static u8 get_cs_inst_id(struct mce *m)
{
+ /* MI300: static mapping table for MCA_IPID[InstanceId] to CS physical ID. */
+ if (df_cfg.rev == DF4p5 && df_cfg.flags.heterogeneous)
+ return fixup_cs_inst_id(m);
+
return FIELD_GET(UMC_CHANNEL_NUM, m->ipid);
}
--
2.25.1
next prev parent reply other threads:[~2023-10-25 7:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 7:33 [PATCH 0/7] Address Translation support for MI200 and MI300 models Muralidhara M K
2023-10-25 7:33 ` [PATCH 1/7] RAS: Add Address Translation support for MI200 Muralidhara M K
2023-10-26 8:44 ` kernel test robot
2023-10-25 7:33 ` [PATCH 2/7] RAS: Add Address Translation support for MI300 Muralidhara M K
2023-10-25 7:33 ` [PATCH 3/7] RAS: Add MCA Error address conversion for UMC Muralidhara M K
2023-10-25 7:33 ` Muralidhara M K [this message]
2023-10-25 7:33 ` [PATCH 5/7] RAS: Add fixed Physical to logical CS ID mapping table Muralidhara M K
2023-10-25 7:33 ` [PATCH 6/7] RAS: Get CS fabirc ID register bit fields Muralidhara M K
2023-10-26 13:55 ` Yazen Ghannam
2023-10-25 7:33 ` [PATCH 7/7] EDAC/amd64: RAS: platform/x86/amd: Identify all physical pages in row Muralidhara M K
2023-10-26 14:31 ` Yazen Ghannam
2023-10-26 13:21 ` [PATCH 0/7] Address Translation support for MI200 and MI300 models Yazen Ghannam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231025073339.630093-5-muralimk@amd.com \
--to=muralimk@amd.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox