aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch
new file mode 100644
index 00000000..46eb6087
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1333-drm-amdkfd-fix-CWSR-memory-allocation-sequence.patch
@@ -0,0 +1,66 @@
+From 0fbcefff6aa4b200b1528d422893c9228e955c69 Mon Sep 17 00:00:00 2001
+From: Eric Huang <JinHuiEric.Huang@amd.com>
+Date: Tue, 22 Aug 2017 11:47:45 -0400
+Subject: [PATCH 1333/4131] drm/amdkfd: fix CWSR memory allocation sequence
+
+it makes CWSR memory kernel address valid after
+memory eviction.
+
+Change-Id: I805bb6653981048ee6a484681fe9b554bd379550
+Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_process.c | 23 ++++++++++++++++++-----
+ 1 file changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+index 3e966a3..2e784dd 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+@@ -115,10 +115,11 @@ static int kfd_process_alloc_gpuvm(struct kfd_process *p,
+ {
+ int err;
+ void *mem = NULL;
++ int handle;
+
+ err = kdev->kfd2kgd->alloc_memory_of_gpu(kdev->kgd, gpu_va, size,
+ pdd->vm,
+- (struct kgd_mem **)&mem, NULL, kptr,
++ (struct kgd_mem **)&mem, NULL, NULL,
+ flags);
+ if (err)
+ goto err_alloc_mem;
+@@ -142,15 +143,27 @@ static int kfd_process_alloc_gpuvm(struct kfd_process *p,
+ * We do not need to take p->mutex, because the process is just
+ * created and the ioctls have not had the chance to run.
+ */
+- if (kfd_process_device_create_obj_handle(
+- pdd, mem, gpu_va, size, NULL) < 0) {
+- err = -ENOMEM;
+- *kptr = NULL;
++ handle = kfd_process_device_create_obj_handle(
++ pdd, mem, gpu_va, size, NULL);
++
++ if (handle < 0) {
++ err = handle;
+ goto free_gpuvm;
+ }
+
++ if (kptr) {
++ err = kdev->kfd2kgd->map_gtt_bo_to_kernel(kdev->kgd,
++ (struct kgd_mem *)mem, kptr);
++ if (err) {
++ pr_debug("Map GTT BO to kernel failed\n");
++ goto free_obj_handle;
++ }
++ }
++
+ return err;
+
++free_obj_handle:
++ kfd_process_device_remove_obj_handle(pdd, handle);
+ free_gpuvm:
+ sync_memory_failed:
+ kfd_process_free_gpuvm(mem, pdd);
+--
+2.7.4
+