Commit a0af5dbd authored by Jonathan Kim's avatar Jonathan Kim Committed by Alex Deucher

drm/amdkfd: simplify cpu hive assignment

CPU hive assignment currently assumes when a GPU hive is connected_to_cpu,
there is only one hive in the system.

Only assign CPUs to the hive if they are explicitly directly connected to
the GPU hive to get rid of the need for this assumption.

It's more efficient to do this when querying IO links since other non-CRAT
info has to be filled in anyways.  Also, stop re-assigning the
same CPU to the same GPU hive if it has already been done before.
Signed-off-by: default avatarJonathan Kim <jonathan.kim@amd.com>
Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2c2dd055
...@@ -1271,6 +1271,12 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev) ...@@ -1271,6 +1271,12 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
if (!peer_dev) if (!peer_dev)
continue; continue;
/* Include the CPU peer in GPU hive if connected over xGMI. */
if (!peer_dev->gpu && !peer_dev->node_props.hive_id &&
dev->node_props.hive_id &&
dev->gpu->adev->gmc.xgmi.connected_to_cpu)
peer_dev->node_props.hive_id = dev->node_props.hive_id;
list_for_each_entry(inbound_link, &peer_dev->io_link_props, list_for_each_entry(inbound_link, &peer_dev->io_link_props,
list) { list) {
if (inbound_link->node_to != link->node_from) if (inbound_link->node_to != link->node_from)
...@@ -1302,22 +1308,6 @@ int kfd_topology_add_device(struct kfd_dev *gpu) ...@@ -1302,22 +1308,6 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
pr_debug("Adding new GPU (ID: 0x%x) to topology\n", gpu_id); pr_debug("Adding new GPU (ID: 0x%x) to topology\n", gpu_id);
/* Include the CPU in xGMI hive if xGMI connected by assigning it the hive ID. */
if (gpu->hive_id && gpu->adev->gmc.xgmi.connected_to_cpu) {
struct kfd_topology_device *top_dev;
down_read(&topology_lock);
list_for_each_entry(top_dev, &topology_device_list, list) {
if (top_dev->gpu)
break;
top_dev->node_props.hive_id = gpu->hive_id;
}
up_read(&topology_lock);
}
/* Check to see if this gpu device exists in the topology_device_list. /* Check to see if this gpu device exists in the topology_device_list.
* If so, assign the gpu to that device, * If so, assign the gpu to that device,
* else create a Virtual CRAT for this gpu device and then parse that * else create a Virtual CRAT for this gpu device and then parse that
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment