When amdgpu_bo_fence is converted to dma_resv_add_fence, the reserve was
removed in that process, so putting it back.

Fixes: 4247084057cf ("drm/amdgpu: use DMA_RESV_USAGE_BOOKKEEP v2")
Signed-off-by: Yunxiang Li <yunxiang...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
index 349416e176a1..f590b97853d9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
@@ -120,6 +120,7 @@ static int amdgpu_vm_sdma_commit(struct 
amdgpu_vm_update_params *p,
        struct amdgpu_ib *ib = p->job->ibs;
        struct amdgpu_ring *ring;
        struct dma_fence *f;
+       int r;
 
        ring = container_of(p->vm->delayed.rq->sched, struct amdgpu_ring,
                            sched);
@@ -135,6 +136,9 @@ static int amdgpu_vm_sdma_commit(struct 
amdgpu_vm_update_params *p,
                swap(p->vm->last_unlocked, tmp);
                dma_fence_put(tmp);
        } else {
+               r = dma_resv_reserve_fences(p->vm->root.bo->tbo.base.resv, 1);
+               if (r)
+                       return r;
                dma_resv_add_fence(p->vm->root.bo->tbo.base.resv, f,
                                   DMA_RESV_USAGE_BOOKKEEP);
        }
-- 
2.41.0

Reply via email to