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 5/7] RAS: Add fixed Physical to logical CS ID mapping table
Date: Wed, 25 Oct 2023 07:33:37 +0000 [thread overview]
Message-ID: <20231025073339.630093-6-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, only one out of 4 AIDs are software-visible using PCI Device 18h.
Add a static lookup table for converting physical CS ID to logical
CS ID for mapping of all 4 respective AIDs in a socket.
Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
---
drivers/ras/amd/atl/denormalize.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/ras/amd/atl/denormalize.c b/drivers/ras/amd/atl/denormalize.c
index b233a26f68fc..4c127347a56e 100644
--- a/drivers/ras/amd/atl/denormalize.c
+++ b/drivers/ras/amd/atl/denormalize.c
@@ -442,6 +442,20 @@ static u16 get_logical_cs_fabric_id(struct addr_ctx *ctx)
return (phys_cs_fabric_id & df_cfg.node_id_mask) | log_cs_fabric_id;
}
+/* Physical CS to Logical CS mapping for MI300 AIDs */
+u16 phy_to_logicalcs_mapping_mi300_aid[] = { 12, 13, 14, 15, 8, 9, 10, 11,
+ 4, 5, 6, 7, 0, 1, 2, 3,
+ 28, 29, 30, 31, 24, 25, 26, 27,
+ 20, 21, 22, 23, 16, 17, 18, 19};
+
+static u16 get_logical_cs_fabric_id_mi300_die(struct addr_ctx *ctx)
+{
+ if (ctx->inst_id >= sizeof(phy_to_logicalcs_mapping_mi300_aid))
+ return -EINVAL;
+
+ return phy_to_logicalcs_mapping_mi300_aid[ctx->inst_id];
+}
+
static int denorm_addr_common(struct addr_ctx *ctx)
{
u64 denorm_addr;
@@ -451,7 +465,11 @@ static int denorm_addr_common(struct addr_ctx *ctx)
* Convert the original physical CS Fabric ID to a logical value.
* This is required for non-power-of-two and other interleaving modes.
*/
- ctx->cs_fabric_id = get_logical_cs_fabric_id(ctx);
+ if (df_cfg.rev == DF4p5 && df_cfg.flags.heterogeneous)
+ ctx->cs_fabric_id = (ctx->cs_fabric_id & df_cfg.node_id_mask) |
+ get_logical_cs_fabric_id_mi300_die(ctx);
+ else
+ ctx->cs_fabric_id = get_logical_cs_fabric_id(ctx);
denorm_addr = make_space_for_cs_id(ctx);
cs_id = calculate_cs_id(ctx);
--
2.25.1
next prev parent reply other threads:[~2023-10-25 7:44 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 ` [PATCH 4/7] RAS: Add static lookup table to get CS physical ID Muralidhara M K
2023-10-25 7:33 ` Muralidhara M K [this message]
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-6-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