[PATCH] drm/amdkfd: Set iolink non-coherent in topology

Eric Huang jinhuieric.huang at amd.com
Wed Jun 16 18:12:15 UTC 2021


Fix non-coherent bit of iolink properties flag
which always is 0.

Signed-off-by: Eric Huang <jinhuieric.huang at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 6075cbfde59f..8ef3add769d7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1336,6 +1336,28 @@ static void kfd_set_iolink_no_atomics(struct kfd_topology_device *dev,
 	}
 }
 
+static void kfd_set_iolink_non_coherent(struct kfd_topology_device *to_dev,
+		struct kfd_iolink_properties *from_link,
+		struct kfd_iolink_properties *to_link)
+{
+	/* CPU -> GPU with PCIe */
+	if (!to_dev->gpu &&
+			to_link->iolink_type == CRAT_IOLINK_TYPE_PCIEXPRESS)
+		to_link->flags |= CRAT_IOLINK_FLAGS_NON_COHERENT;
+
+	if (to_dev->gpu) {
+		/* GPU <-> GPU with PCIe and
+		 * Vega20 with XGMI
+		 */
+		if (to_link->iolink_type == CRAT_IOLINK_TYPE_PCIEXPRESS ||
+				(to_link->iolink_type == CRAT_IOLINK_TYPE_XGMI &&
+				to_dev->gpu->device_info->asic_family == CHIP_VEGA20)) {
+			from_link->flags |= CRAT_IOLINK_FLAGS_NON_COHERENT;
+			to_link->flags |= CRAT_IOLINK_FLAGS_NON_COHERENT;
+		}
+	}
+}
+
 static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
 {
 	struct kfd_iolink_properties *link, *inbound_link;
@@ -1361,6 +1383,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);
 		}
 	}
 
-- 
2.25.1



More information about the amd-gfx mailing list