aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch
new file mode 100644
index 00000000..f4d0aa6b
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1400-Fix-an-error-handling-problem.patch
@@ -0,0 +1,86 @@
+From 07e792058452e015c53e64780453af18060f9c62 Mon Sep 17 00:00:00 2001
+From: Yong Zhao <yong.zhao@amd.com>
+Date: Thu, 21 Apr 2016 17:02:08 -0400
+Subject: [PATCH 1400/4131] Fix an error handling problem
+
+Change-Id: Ifd7c1d591b6ce542f0ced7a7db8afff18e02da8a
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 22 +++++++++++++++++-----
+ 1 file changed, 17 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index 0db8980..8ec4859 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -68,7 +68,8 @@ static bool check_if_add_bo_to_vm(struct amdgpu_vm *avm,
+ }
+
+ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
+- struct amdgpu_vm *avm, bool is_aql)
++ struct amdgpu_vm *avm, bool is_aql,
++ struct kfd_bo_va_list **p_bo_va_entry)
+ {
+ int ret;
+ struct kfd_bo_va_list *bo_va_entry;
+@@ -121,6 +122,9 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem,
+ bo_va_entry->is_mapped = false;
+ list_add(&bo_va_entry->bo_list, list_bo_va);
+
++ if (p_bo_va_entry)
++ *p_bo_va_entry = bo_va_entry;
++
+ return 0;
+
+ err_vmsetaddr:
+@@ -823,6 +827,8 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
+ uint32_t domain;
+ struct kfd_bo_va_list *entry;
+ struct bo_vm_reservation_context ctx;
++ struct kfd_bo_va_list *bo_va_entry = NULL;
++ struct kfd_bo_va_list *bo_va_entry_aql = NULL;
+
+ BUG_ON(kgd == NULL);
+ BUG_ON(mem == NULL);
+@@ -847,14 +853,15 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
+ if (check_if_add_bo_to_vm((struct amdgpu_vm *)vm, mem)) {
+ pr_debug("amdkfd: add new BO_VA to list 0x%llx\n",
+ mem->data2.va);
+- ret = add_bo_to_vm(adev, mem, (struct amdgpu_vm *)vm, false);
++ ret = add_bo_to_vm(adev, mem, (struct amdgpu_vm *)vm, false,
++ &bo_va_entry);
+ if (ret != 0)
+ goto add_bo_to_vm_failed;
+ if (mem->data2.aql_queue) {
+ ret = add_bo_to_vm(adev, mem, (struct amdgpu_vm *)vm,
+- true);
++ true, &bo_va_entry_aql);
+ if (ret != 0)
+- goto add_bo_to_vm_failed;
++ goto add_bo_to_vm_failed_aql;
+ }
+ }
+
+@@ -914,6 +921,11 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
+ pin_bo_failed:
+ quiesce_failed:
+ update_user_pages_failed:
++ if (bo_va_entry_aql)
++ remove_bo_from_vm(adev, bo_va_entry_aql);
++add_bo_to_vm_failed_aql:
++ if (bo_va_entry)
++ remove_bo_from_vm(adev, bo_va_entry);
+ add_bo_to_vm_failed:
+ unreserve_bo_and_vms(&ctx, false);
+ bo_reserve_failed:
+@@ -1391,7 +1403,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, int dma_buf_fd,
+ AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
+ (*mem)->data2.mapped_to_gpu_memory = 0;
+
+- r = add_bo_to_vm(adev, *mem, vm, false);
++ r = add_bo_to_vm(adev, *mem, vm, false, NULL);
+
+ if (r) {
+ amdgpu_bo_unref(&bo);
+--
+2.7.4
+