summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
diff options
context:
space:
mode:
authorHarish Kasiviswanathan <harish.kasiviswanathan@amd.com>2017-12-09 07:08:51 +0300
committerOded Gabbay <oded.gabbay@gmail.com>2017-12-09 07:08:51 +0300
commit8e05247d4c23ff1c91682cf28d2ddb4210808e7d (patch)
tree7a2cf809c3e4660e62a499939e7e40bfa5691da5 /drivers/gpu/drm/amd/amdkfd/kfd_topology.c
parent174de876d6d02f7159363495a3f34461ba91d3ee (diff)
downloadlinux-8e05247d4c23ff1c91682cf28d2ddb4210808e7d.tar.xz
drm/amdkfd: Reorganize CRAT fetching from ACPI
Reorganize and rename kfd_topology_get_crat_acpi function. In this way acpi_get_table(..) needs to be called only once. This will also aid in dGPU topology implementation. Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Signed-off-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_topology.c')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index b6cf785d0138..35da4af28c87 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -699,35 +699,31 @@ int kfd_topology_init(void)
/*
* Get the CRAT image from the ACPI
*/
- ret = kfd_topology_get_crat_acpi(crat_image, &image_size);
- if (ret == 0 && image_size > 0) {
- pr_info("Found CRAT image with size=%zd\n", image_size);
- crat_image = kmalloc(image_size, GFP_KERNEL);
- if (!crat_image) {
- ret = -ENOMEM;
- pr_err("No memory for allocating CRAT image\n");
+ ret = kfd_create_crat_image_acpi(&crat_image, &image_size);
+ if (!ret) {
+ ret = kfd_parse_crat_table(crat_image);
+ if (ret)
goto err;
- }
- ret = kfd_topology_get_crat_acpi(crat_image, &image_size);
-
- if (ret == 0) {
- down_write(&topology_lock);
- ret = kfd_parse_crat_table(crat_image);
- if (ret == 0)
- ret = kfd_topology_update_sysfs();
- up_write(&topology_lock);
- } else {
- pr_err("Couldn't get CRAT table size from ACPI\n");
- }
- kfree(crat_image);
} else if (ret == -ENODATA) {
+ /* TODO: Create fake CRAT table */
ret = 0;
+ goto err;
} else {
pr_err("Couldn't get CRAT table size from ACPI\n");
+ goto err;
}
+ down_write(&topology_lock);
+ ret = kfd_topology_update_sysfs();
+ up_write(&topology_lock);
+
+ if (!ret)
+ pr_info("Finished initializing topology\n");
+ else
+ pr_err("Failed to update topology in sysfs ret=%d\n", ret);
+
err:
- pr_info("Finished initializing topology ret=%d\n", ret);
+ kfd_destroy_crat_image(crat_image);
return ret;
}
@@ -747,7 +743,7 @@ static void kfd_debug_print_topology(void)
pr_info("Node: %d\n", i);
pr_info("\tGPU assigned: %s\n", (dev->gpu ? "yes" : "no"));
pr_info("\tCPU count: %d\n", dev->node_props.cpu_cores_count);
- pr_info("\tSIMD count: %d", dev->node_props.simd_count);
+ pr_info("\tSIMD count: %d\n", dev->node_props.simd_count);
i++;
}
}