aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch
new file mode 100644
index 00000000..f0cf1798
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1271-drm-amdkfd-Remove-unaligned-memory-access.patch
@@ -0,0 +1,91 @@
+From 23d9c1b932cb448a3e420b04c1c9350b72a19fad Mon Sep 17 00:00:00 2001
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Date: Thu, 27 Apr 2017 12:08:04 -0400
+Subject: [PATCH 1271/4131] drm/amdkfd: Remove unaligned memory access
+
+Use simpler bitmask operations instead. Atomic bit manipulations
+are not necessary since qm->lock is held during these operations.
+
+Change-Id: I5d003a03f91cacb3b33abe3cfbb78a5d9bb78c78
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+---
+ .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 25 ++++++++--------------
+ 1 file changed, 9 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+index 24ef621..702fc4a 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+@@ -197,9 +197,8 @@ static int allocate_vmid(struct device_queue_manager *dqm,
+ if (dqm->vmid_bitmap == 0)
+ return -ENOMEM;
+
+- bit = find_first_bit((unsigned long *)&dqm->vmid_bitmap,
+- dqm->dev->vm_info.vmid_num_kfd);
+- clear_bit(bit, (unsigned long *)&dqm->vmid_bitmap);
++ bit = ffs(dqm->vmid_bitmap) - 1;
++ dqm->vmid_bitmap &= ~(1 << bit);
+
+ allocated_vmid = bit + dqm->dev->vm_info.first_vmid_kfd;
+ pr_debug("kfd: vmid allocation %d\n", allocated_vmid);
+@@ -250,7 +249,7 @@ static void deallocate_vmid(struct device_queue_manager *dqm,
+ /* Release the vmid mapping */
+ set_pasid_vmid_mapping(dqm, 0, qpd->vmid);
+
+- set_bit(bit, (unsigned long *)&dqm->vmid_bitmap);
++ dqm->vmid_bitmap |= (1 << bit);
+ qpd->vmid = 0;
+ q->properties.vmid = 0;
+ }
+@@ -344,12 +343,8 @@ static int allocate_hqd(struct device_queue_manager *dqm, struct queue *q)
+ continue;
+
+ if (dqm->allocated_queues[pipe] != 0) {
+- bit = find_first_bit(
+- (unsigned long *)&dqm->allocated_queues[pipe],
+- get_queues_per_pipe(dqm));
+-
+- clear_bit(bit,
+- (unsigned long *)&dqm->allocated_queues[pipe]);
++ bit = ffs(dqm->allocated_queues[pipe]) - 1;
++ dqm->allocated_queues[pipe] &= ~(1 << bit);
+ q->pipe = pipe;
+ q->queue = bit;
+ set = true;
+@@ -371,7 +366,7 @@ static int allocate_hqd(struct device_queue_manager *dqm, struct queue *q)
+ static inline void deallocate_hqd(struct device_queue_manager *dqm,
+ struct queue *q)
+ {
+- set_bit(q->queue, (unsigned long *)&dqm->allocated_queues[q->pipe]);
++ dqm->allocated_queues[q->pipe] |= (1 << q->queue);
+ }
+
+ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm,
+@@ -900,10 +895,8 @@ static int allocate_sdma_queue(struct device_queue_manager *dqm,
+ if (dqm->sdma_bitmap == 0)
+ return -ENOMEM;
+
+- bit = find_first_bit((unsigned long *)&dqm->sdma_bitmap,
+- CIK_SDMA_QUEUES);
+-
+- clear_bit(bit, (unsigned long *)&dqm->sdma_bitmap);
++ bit = ffs(dqm->sdma_bitmap) - 1;
++ dqm->sdma_bitmap &= ~(1 << bit);
+ *sdma_queue_id = bit;
+
+ return 0;
+@@ -914,7 +907,7 @@ static void deallocate_sdma_queue(struct device_queue_manager *dqm,
+ {
+ if (sdma_queue_id >= CIK_SDMA_QUEUES)
+ return;
+- set_bit(sdma_queue_id, (unsigned long *)&dqm->sdma_bitmap);
++ dqm->sdma_bitmap |= (1 << sdma_queue_id);
+ }
+
+ static int create_sdma_queue_nocpsch(struct device_queue_manager *dqm,
+--
+2.7.4
+