aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>2017-12-08 23:08:57 -0500
committerOded Gabbay <oded.gabbay@gmail.com>2017-12-08 23:08:57 -0500
commitbc0c75a36722be4537a9266940ddcd4f826234c4 (patch)
tree8caaa718a019baa812b60bfde521be6386e42851
parent175b926335c9ce30a531b7a162dde055e7182cbe (diff)
drm/amdkfd: Fix sibling_map[] size
Change kfd_cache_properties.sibling_map[256] to kfd_cache_properties.sibling_map[32]. Since, CRAT uses bitmap for sibling_map, it is more efficient to use bitmap in the kfd structure also. 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.c20
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.h4
2 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 17e8daf96b4f..622fedaa5b39 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -263,7 +263,7 @@ static ssize_t kfd_cache_show(struct kobject *kobj, struct attribute *attr,
263 char *buffer) 263 char *buffer)
264{ 264{
265 ssize_t ret; 265 ssize_t ret;
266 uint32_t i; 266 uint32_t i, j;
267 struct kfd_cache_properties *cache; 267 struct kfd_cache_properties *cache;
268 268
269 /* Making sure that the buffer is an empty string */ 269 /* Making sure that the buffer is an empty string */
@@ -281,12 +281,18 @@ static ssize_t kfd_cache_show(struct kobject *kobj, struct attribute *attr,
281 sysfs_show_32bit_prop(buffer, "latency", cache->cache_latency); 281 sysfs_show_32bit_prop(buffer, "latency", cache->cache_latency);
282 sysfs_show_32bit_prop(buffer, "type", cache->cache_type); 282 sysfs_show_32bit_prop(buffer, "type", cache->cache_type);
283 snprintf(buffer, PAGE_SIZE, "%ssibling_map ", buffer); 283 snprintf(buffer, PAGE_SIZE, "%ssibling_map ", buffer);
284 for (i = 0; i < KFD_TOPOLOGY_CPU_SIBLINGS; i++) 284 for (i = 0; i < CRAT_SIBLINGMAP_SIZE; i++)
285 ret = snprintf(buffer, PAGE_SIZE, "%s%d%s", 285 for (j = 0; j < sizeof(cache->sibling_map[0])*8; j++) {
286 buffer, cache->sibling_map[i], 286 /* Check each bit */
287 (i == KFD_TOPOLOGY_CPU_SIBLINGS-1) ? 287 if (cache->sibling_map[i] & (1 << j))
288 "\n" : ","); 288 ret = snprintf(buffer, PAGE_SIZE,
289 289 "%s%d%s", buffer, 1, ",");
290 else
291 ret = snprintf(buffer, PAGE_SIZE,
292 "%s%d%s", buffer, 0, ",");
293 }
294 /* Replace the last "," with end of line */
295 *(buffer + strlen(buffer) - 1) = 0xA;
290 return ret; 296 return ret;
291} 297}
292 298
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index 17b2d4383bf9..50a741ba51e0 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -91,8 +91,6 @@ struct kfd_mem_properties {
91 struct attribute attr; 91 struct attribute attr;
92}; 92};
93 93
94#define KFD_TOPOLOGY_CPU_SIBLINGS 256
95
96#define HSA_CACHE_TYPE_DATA 0x00000001 94#define HSA_CACHE_TYPE_DATA 0x00000001
97#define HSA_CACHE_TYPE_INSTRUCTION 0x00000002 95#define HSA_CACHE_TYPE_INSTRUCTION 0x00000002
98#define HSA_CACHE_TYPE_CPU 0x00000004 96#define HSA_CACHE_TYPE_CPU 0x00000004
@@ -109,7 +107,7 @@ struct kfd_cache_properties {
109 uint32_t cache_assoc; 107 uint32_t cache_assoc;
110 uint32_t cache_latency; 108 uint32_t cache_latency;
111 uint32_t cache_type; 109 uint32_t cache_type;
112 uint8_t sibling_map[KFD_TOPOLOGY_CPU_SIBLINGS]; 110 uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
113 struct kobject *kobj; 111 struct kobject *kobj;
114 struct attribute attr; 112 struct attribute attr;
115}; 113};