aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch
new file mode 100644
index 00000000..0b6299ee
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4509-drm-amdgpu-consistenly-use-VM-moved-flag.patch
@@ -0,0 +1,91 @@
+From f348c4327234195ee2100312e4063e0c560064de Mon Sep 17 00:00:00 2001
+From: christian koenig <christian.koenig@amd.com>
+Date: Thu, 19 Apr 2018 14:22:56 +0200
+Subject: [PATCH 4509/5725] drm/amdgpu: consistenly use VM moved flag
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Instead of sometimes checking if the vm_status is empty use the moved
+flag and also reset it when the BO leaves the state machine.
+
+Change-Id: I6d617e5ad799fbbaf6e85b178e267bf689df52c1
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
+Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
+Signed-off-by: Kalyan Alle <kalyan.alle@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 28 ++++++++++++++++++----------
+ 1 file changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+index cbf3a2f..7ddbfe3 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+@@ -903,8 +903,8 @@ static void amdgpu_vm_invalidate_level(struct amdgpu_device *adev,
+ if (!entry->base.bo)
+ continue;
+
+- if (list_empty(&entry->base.vm_status))
+- list_add(&entry->base.vm_status, &vm->relocated);
++ if (!entry->base.moved)
++ list_move(&entry->base.vm_status, &vm->relocated);
+ amdgpu_vm_invalidate_level(adev, vm, entry, level + 1);
+ }
+ }
+@@ -965,6 +965,7 @@ int amdgpu_vm_update_directories(struct amdgpu_device *adev,
+ bo_base = list_first_entry(&vm->relocated,
+ struct amdgpu_vm_bo_base,
+ vm_status);
++ bo_base->moved = false;
+ list_del_init(&bo_base->vm_status);
+
+ bo = bo_base->bo->parent;
+@@ -1907,10 +1908,10 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
+ if (mapping->flags & AMDGPU_PTE_PRT)
+ amdgpu_vm_prt_get(adev);
+
+- if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
++ if (bo && bo->tbo.resv == vm->root.base.bo->tbo.resv &&
++ !bo_va->base.moved) {
+ spin_lock(&vm->moved_lock);
+- if (list_empty(&bo_va->base.vm_status))
+- list_add(&bo_va->base.vm_status, &vm->moved);
++ list_move(&bo_va->base.vm_status, &vm->moved);
+ spin_unlock(&vm->moved_lock);
+ }
+ trace_amdgpu_vm_bo_map(bo_va, mapping);
+@@ -2263,6 +2264,7 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
+
+ list_for_each_entry(bo_base, &bo->va, bo_list) {
+ struct amdgpu_vm *vm = bo_base->vm;
++ bool was_moved = bo_base->moved;
+
+ bo_base->moved = true;
+ if (evicted && bo->tbo.resv == vm->root.base.bo->tbo.resv) {
+@@ -2281,11 +2283,17 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
+
+ continue;
+ }
+-
+- spin_lock(&bo_base->vm->moved_lock);
+- if (list_empty(&bo_base->vm_status))
+- list_add(&bo_base->vm_status, &vm->moved);
+- spin_unlock(&bo_base->vm->moved_lock);
++
++ if (was_moved)
++ continue;
++
++ if (bo->tbo.type == ttm_bo_type_kernel) {
++ list_move(&bo_base->vm_status, &vm->relocated);
++ } else {
++ spin_lock(&bo_base->vm->moved_lock);
++ list_move(&bo_base->vm_status, &vm->moved);
++ spin_unlock(&bo_base->vm->moved_lock);
++ }
+ }
+ }
+
+--
+2.7.4
+