aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch
new file mode 100644
index 00000000..7ae2475f
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3425-drm-amdkfd-Fix-sibling_map-size.patch
@@ -0,0 +1,82 @@
+From 7f7ed0d86c48043ea2333c49c276981e4466b6db Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Fri, 8 Dec 2017 23:08:57 -0500
+Subject: [PATCH 3425/4131] 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>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 20 +++++++++++++-------
+ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 4 +---
+ 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 17e8daf..622feda 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,
+ char *buffer)
+ {
+ ssize_t ret;
+- uint32_t i;
++ uint32_t i, j;
+ struct kfd_cache_properties *cache;
+
+ /* 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,
+ sysfs_show_32bit_prop(buffer, "latency", cache->cache_latency);
+ sysfs_show_32bit_prop(buffer, "type", cache->cache_type);
+ snprintf(buffer, PAGE_SIZE, "%ssibling_map ", buffer);
+- for (i = 0; i < KFD_TOPOLOGY_CPU_SIBLINGS; i++)
+- ret = snprintf(buffer, PAGE_SIZE, "%s%d%s",
+- buffer, cache->sibling_map[i],
+- (i == KFD_TOPOLOGY_CPU_SIBLINGS-1) ?
+- "\n" : ",");
+-
++ for (i = 0; i < CRAT_SIBLINGMAP_SIZE; i++)
++ for (j = 0; j < sizeof(cache->sibling_map[0])*8; j++) {
++ /* Check each bit */
++ if (cache->sibling_map[i] & (1 << j))
++ ret = snprintf(buffer, PAGE_SIZE,
++ "%s%d%s", buffer, 1, ",");
++ else
++ ret = snprintf(buffer, PAGE_SIZE,
++ "%s%d%s", buffer, 0, ",");
++ }
++ /* Replace the last "," with end of line */
++ *(buffer + strlen(buffer) - 1) = 0xA;
+ return ret;
+ }
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+index 17b2d43..50a741b 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 {
+ struct attribute attr;
+ };
+
+-#define KFD_TOPOLOGY_CPU_SIBLINGS 256
+-
+ #define HSA_CACHE_TYPE_DATA 0x00000001
+ #define HSA_CACHE_TYPE_INSTRUCTION 0x00000002
+ #define HSA_CACHE_TYPE_CPU 0x00000004
+@@ -109,7 +107,7 @@ struct kfd_cache_properties {
+ uint32_t cache_assoc;
+ uint32_t cache_latency;
+ uint32_t cache_type;
+- uint8_t sibling_map[KFD_TOPOLOGY_CPU_SIBLINGS];
++ uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
+ struct kobject *kobj;
+ struct attribute attr;
+ };
+--
+2.7.4
+