[PATCH 4/4] drm/amdkfd: add direct link flag to link properties

Kasiviswanathan, Harish Harish.Kasiviswanathan at amd.com
Fri Jul 9 20:28:20 UTC 2021


[AMD Official Use Only]

This series Acked-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>

-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Jonathan Kim
Sent: Monday, June 21, 2021 3:24 PM
To: amd-gfx at lists.freedesktop.org
Cc: Kuehling, Felix <Felix.Kuehling at amd.com>; Kim, Jonathan <Jonathan.Kim at amd.com>; Zhang, Hawking <Hawking.Zhang at amd.com>
Subject: [PATCH 4/4] drm/amdkfd: add direct link flag to link properties

Flag peers as a direct link if over PCIe or over xGMI if they are adjacent in the hive.

Signed-off-by: Jonathan Kim <jonathan.kim at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_crat.h     |  3 ++-
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
index d1f6de5edfb9..0d661d60ece6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.h
@@ -232,8 +232,9 @@ struct crat_subtype_ccompute {
 #define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT	(1 << 2)
 #define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT	(1 << 3)
 #define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA	(1 << 4)
+#define CRAT_IOLINK_FLAGS_DIRECT_LINK		(1 << 5)
 #define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL 	(1 << 31)
-#define CRAT_IOLINK_FLAGS_RESERVED_MASK		0x7fffffe0
+#define CRAT_IOLINK_FLAGS_RESERVED_MASK		0x7fffffc0
 
 /*
  * IO interface types
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index b1ce072aa20b..037fa12ac1bc 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1244,6 +1244,15 @@ static void kfd_set_iolink_non_coherent(struct kfd_topology_device *to_dev,
 	}
 }
 
+static void kfd_set_iolink_direct_link(struct kfd_topology_device *dev,
+					struct kfd_iolink_properties *link) {
+	if (link->iolink_type == CRAT_IOLINK_TYPE_PCIEXPRESS ||
+			(link->iolink_type == CRAT_IOLINK_TYPE_XGMI &&
+							link->max_bandwidth))
+		link->flags |= CRAT_IOLINK_FLAGS_DIRECT_LINK; }
+
 static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)  {
 	struct kfd_iolink_properties *link, *inbound_link; @@ -1256,6 +1265,7 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
 	list_for_each_entry(link, &dev->io_link_props, list) {
 		link->flags = CRAT_IOLINK_FLAGS_ENABLED;
 		kfd_set_iolink_no_atomics(dev, NULL, link);
+		kfd_set_iolink_direct_link(dev, link);
 		peer_dev = kfd_topology_device_by_proximity_domain(
 				link->node_to);
 
@@ -1270,6 +1280,7 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
 			inbound_link->flags = CRAT_IOLINK_FLAGS_ENABLED;
 			kfd_set_iolink_no_atomics(peer_dev, dev, inbound_link);
 			kfd_set_iolink_non_coherent(peer_dev, link, inbound_link);
+			kfd_set_iolink_direct_link(peer_dev, inbound_link);
 		}
 	}
 }
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Charish.kasiviswanathan%40amd.com%7C92cd10a23764408da0ec08d934ea2680%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637599002557866754%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=utRekyrx5G9DD4TSayfxKwLFWv%2FnFlgzSErE7m6zdEw%3D&reserved=0


More information about the amd-gfx mailing list