1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
From b2ea8bd3b95f1d2a251a07ac307ac6584ea690e0 Mon Sep 17 00:00:00 2001
From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Date: Thu, 20 Apr 2017 12:14:12 -0400
Subject: [PATCH 1663/4131] drm/amdkfd: Ignore ACPI CRAT for non APU systems
Bug: SWDEV-112350
Change-Id: I768009dd4622627cf0b913f6034100ef5bcb90be
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Conflicts:
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 58 ++++++++++++++++++++++++++-----
1 file changed, 50 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 605e42f..603fcde9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -951,6 +951,33 @@ static void kfd_add_non_crat_information(struct kfd_topology_device *kdev)
/* TODO: For GPU node, rearrange code from kfd_topology_add_device */
}
+/* kfd_is_acpi_crat_invalid - CRAT from ACPI is valid only for AMD APU devices.
+ * Ignore CRAT for all other devices. AMD APU is identified if both CPU
+ * and GPU cores are present.
+ * @device_list - topology device list created by parsing ACPI CRAT table.
+ * @return - TRUE if invalid, FALSE is valid.
+ */
+static bool kfd_is_acpi_crat_invalid(struct list_head *device_list)
+{
+ struct kfd_topology_device *dev;
+
+ list_for_each_entry(dev, device_list, list) {
+ if (dev->node_props.cpu_cores_count &&
+ dev->node_props.simd_count)
+ return false;
+ }
+ pr_info("Ignoring ACPI CRAT on non-APU system\n");
+ return true;
+}
+
+static void kfd_delete_topology_device_list(struct list_head *device_list)
+{
+ struct kfd_topology_device *dev, *tmp;
+
+ list_for_each_entry_safe(dev, tmp, device_list, list)
+ kfd_release_topology_device(dev);
+}
+
int kfd_topology_init(void)
{
void *crat_image = NULL;
@@ -984,25 +1011,40 @@ int kfd_topology_init(void)
/*
* Get the CRAT image from the ACPI. If ACPI doesn't have one
- * create a virtual CRAT.
+ * or if ACPI CRAT is invalid create a virtual CRAT.
* NOTE: The current implementation expects all AMD APUs to have
* CRAT. If no CRAT is available, it is assumed to be a CPU
*/
ret = kfd_create_crat_image_acpi(&crat_image, &image_size);
- if (ret != 0) {
+ if (ret == 0) {
+ ret = kfd_parse_crat_table(crat_image,
+ &temp_topology_device_list,
+ proximity_domain);
+ if (ret ||
+ kfd_is_acpi_crat_invalid(&temp_topology_device_list)) {
+
+ kfd_delete_topology_device_list(
+ &temp_topology_device_list);
+ INIT_LIST_HEAD(&temp_topology_device_list);
+ kfd_destroy_crat_image(crat_image);
+ crat_image = NULL;
+ }
+ }
+
+ if (!crat_image) {
ret = kfd_create_crat_image_virtual(&crat_image, &image_size,
COMPUTE_UNIT_CPU, NULL,
proximity_domain);
cpu_only_node = 1;
- }
- if (ret == 0)
- ret = kfd_parse_crat_table(crat_image,
+ if (ret == 0)
+ ret = kfd_parse_crat_table(crat_image,
&temp_topology_device_list,
proximity_domain);
- else {
- pr_err("Error getting/creating CRAT table\n");
- goto err;
+ else {
+ pr_err("Error getting/creating CRAT table\n");
+ goto err;
+ }
}
kdev = list_first_entry(&temp_topology_device_list,
--
2.7.4
|