summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-04-07 06:44:26 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-04-07 06:44:26 +0000
commitcfa45d983abe68b7145f82fea6c52660e075b84a (patch)
tree0355648d7d83344845d63c96dde3360bc3e0358e
parent9feb805182753637b3b4f722434c7dc59d8f7a00 (diff)
drm/amdgpu: check vm ready by amdgpu_vm->evicting flag
From Qiang Yu a9c6e02d223e327fa928fab3263aa47b9ba20253 in linux 5.15.y/5.15.27 c1a66c3bc425ff93774fb2f6eefa67b83170dd7e in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c
index 638e11652e6..a0b2862b2eb 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_vm.c
@@ -834,11 +834,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
* Check if all VM PDs/PTs are ready for updates
*
* Returns:
- * True if eviction list is empty.
+ * True if VM is not evicting.
*/
bool amdgpu_vm_ready(struct amdgpu_vm *vm)
{
- return list_empty(&vm->evicted);
+ bool ret;
+
+ amdgpu_vm_eviction_lock(vm);
+ ret = !vm->evicting;
+ amdgpu_vm_eviction_unlock(vm);
+ return ret;
}
/**