aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch
new file mode 100644
index 00000000..acd2be30
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1319-drm-amdkfd-Allocate-gtt_sa_bitmap-in-long-units.patch
@@ -0,0 +1,45 @@
+From 5f4cbf831d328417adb7580067b33a340d74a42b Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Sat, 29 Jul 2017 04:46:48 -0400
+Subject: [PATCH 1319/4131] drm/amdkfd: Allocate gtt_sa_bitmap in long units
+
+gtt_sa_bitmap is accessed by bitmap functions, which operate on longs.
+Therefore the array should be allocated in long units. Also round up
+in case the number of bits is not a multiple of BITS_PER_LONG.
+
+Change-Id: I023409ace88bee694a0b5d59df1b6b06ef85c5ef
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+index d28a8ee..da05b68 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+@@ -1072,18 +1072,15 @@ void kfd_evict_bo_worker(struct work_struct *work)
+ static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
+ unsigned int chunk_size)
+ {
+- unsigned int num_of_bits;
++ unsigned int num_of_longs;
+
+ kfd->gtt_sa_chunk_size = chunk_size;
+ kfd->gtt_sa_num_of_chunks = buf_size / chunk_size;
+
+- num_of_bits = kfd->gtt_sa_num_of_chunks / BITS_PER_BYTE;
+- if (num_of_bits == 0) {
+- pr_err("Number of bits is 0 in %s", __func__);
+- return -EINVAL;
+- }
++ num_of_longs = (kfd->gtt_sa_num_of_chunks + BITS_PER_LONG - 1) /
++ BITS_PER_LONG;
+
+- kfd->gtt_sa_bitmap = kzalloc(num_of_bits, GFP_KERNEL);
++ kfd->gtt_sa_bitmap = kcalloc(num_of_longs, sizeof(long), GFP_KERNEL);
+
+ if (!kfd->gtt_sa_bitmap)
+ return -ENOMEM;
+--
+2.7.4
+