[PATCH 4/4] drm/amdkfd: add direct link flag to link properties
Jonathan Kim
jonathan.kim at amd.com
Mon Jun 21 19:23:48 UTC 2021
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
More information about the amd-gfx
mailing list