Page table updates may result in PT/PD allocation, which can add up to
TTM_NUM_MOVE_FENCES to the resv.

Fixes: 897ee11ec020 ("drm/amdgpu: create multiple clear/move ttm entities")
Fixes: ddc3c87584e2 ("drm/amdgpu: clear vm pts upon a vm->generation mismatch")
Signed-off-by: Benjamin Cheng <[email protected]>
---
v3:
(Christian)
- Don't introduce AMDGPU_VM_UPDATE_FENCES
- Use 2 instead of 3 here since last_unlocked and SDMA commit are from
  the same entity
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 8cc5964f29c0..4d31c41fb684 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -464,7 +464,7 @@ int amdgpu_vm_lock_pd(struct amdgpu_vm *vm, struct drm_exec 
*exec,
 {
        /* We need at least two fences for the VM PD/PT updates */
        return drm_exec_prepare_obj(exec, &vm->root.bo->tbo.base,
-                                   2 + num_fences);
+                                   2 + TTM_NUM_MOVE_FENCES + num_fences);
 }
 
 /**
-- 
2.56.1

Reply via email to