aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>2017-12-08 23:09:04 -0500
committerOded Gabbay <oded.gabbay@gmail.com>2017-12-08 23:09:04 -0500
commitb441093e40e14d8305f0bee37cbaa3fa2e6ce8d0 (patch)
treec83dcd9b459f8567d782389dc770c1c8e913f71e
parentebcfd1e276207e4436a6d15a81f7e151a103565c (diff)
drm/amdkfd: Ignore ACPI CRAT for non-APU systems
Some AMD motherboards without an APU have a broken CRAT table which causes KFD initialization failures or incorrect information about NUMA nodes, CPU cores or system memory. Ignore CRAT tables without GPUs and rely on KFD's code to create a CRAT table for the CPU. Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@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>
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index e7daf2cf8000..c6a76090a725 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -904,6 +904,25 @@ static void kfd_add_non_crat_information(struct kfd_topology_device *kdev)
904 /* TODO: For GPU node, rearrange code from kfd_topology_add_device */ 904 /* TODO: For GPU node, rearrange code from kfd_topology_add_device */
905} 905}
906 906
907/* kfd_is_acpi_crat_invalid - CRAT from ACPI is valid only for AMD APU devices.
908 * Ignore CRAT for all other devices. AMD APU is identified if both CPU
909 * and GPU cores are present.
910 * @device_list - topology device list created by parsing ACPI CRAT table.
911 * @return - TRUE if invalid, FALSE is valid.
912 */
913static bool kfd_is_acpi_crat_invalid(struct list_head *device_list)
914{
915 struct kfd_topology_device *dev;
916
917 list_for_each_entry(dev, device_list, list) {
918 if (dev->node_props.cpu_cores_count &&
919 dev->node_props.simd_count)
920 return false;
921 }
922 pr_info("Ignoring ACPI CRAT on non-APU system\n");
923 return true;
924}
925
907int kfd_topology_init(void) 926int kfd_topology_init(void)
908{ 927{
909 void *crat_image = NULL; 928 void *crat_image = NULL;
@@ -936,7 +955,7 @@ int kfd_topology_init(void)
936 955
937 /* 956 /*
938 * Get the CRAT image from the ACPI. If ACPI doesn't have one 957 * Get the CRAT image from the ACPI. If ACPI doesn't have one
939 * create a virtual CRAT. 958 * or if ACPI CRAT is invalid create a virtual CRAT.
940 * NOTE: The current implementation expects all AMD APUs to have 959 * NOTE: The current implementation expects all AMD APUs to have
941 * CRAT. If no CRAT is available, it is assumed to be a CPU 960 * CRAT. If no CRAT is available, it is assumed to be a CPU
942 */ 961 */
@@ -945,7 +964,8 @@ int kfd_topology_init(void)
945 ret = kfd_parse_crat_table(crat_image, 964 ret = kfd_parse_crat_table(crat_image,
946 &temp_topology_device_list, 965 &temp_topology_device_list,
947 proximity_domain); 966 proximity_domain);
948 if (ret) { 967 if (ret ||
968 kfd_is_acpi_crat_invalid(&temp_topology_device_list)) {
949 kfd_release_topology_device_list( 969 kfd_release_topology_device_list(
950 &temp_topology_device_list); 970 &temp_topology_device_list);
951 kfd_destroy_crat_image(crat_image); 971 kfd_destroy_crat_image(crat_image);