[PATCH] drm/amdkfd: surface xgmi physical node id in the kfd topology

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add the xgmi node's physical node id to the kfd topology node properties.

The physical node id is a 0-indexed, monotonically increasing id that is
statically assigned based on the node's frame buffer position within the
hive.

This is useful because the id is also used by the DF for xGMI peer to peer
routing purposes, giving more transparency to xGMI IO linkage.

Signed-off-by: Jonathan Kim <jonathan.kim@xxxxxxx>
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 8d50d207cf66..615a4f586edb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -503,6 +503,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
 			      dev->node_props.drm_render_minor);
 	sysfs_show_64bit_prop(buffer, offs, "hive_id",
 			      dev->node_props.hive_id);
+	sysfs_show_32bit_prop(buffer, offs, "hive_node_phy_id",
+			      dev->node_props.hive_node_phy_id);
 	sysfs_show_32bit_prop(buffer, offs, "num_sdma_engines",
 			      dev->node_props.num_sdma_engines);
 	sysfs_show_32bit_prop(buffer, offs, "num_sdma_xgmi_engines",
@@ -1398,6 +1400,8 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
 		gpu->shared_resources.drm_render_minor;
 
 	dev->node_props.hive_id = gpu->hive_id;
+	dev->node_props.hive_node_phy_id = gpu->hive_id ?
+				gpu->adev->gmc.xgmi.physical_node_id : 0;
 	dev->node_props.num_sdma_engines = kfd_get_num_sdma_engines(gpu);
 	dev->node_props.num_sdma_xgmi_engines =
 					kfd_get_num_xgmi_sdma_engines(gpu);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index c838863f1fe8..a49267928b55 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -33,6 +33,7 @@
 
 struct kfd_node_properties {
 	uint64_t hive_id;
+	uint32_t hive_node_phy_id;
 	uint32_t cpu_cores_count;
 	uint32_t simd_count;
 	uint32_t mem_banks_count;
-- 
2.25.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux