It needn't to explicitly reserve the dma_resv slot here, the slot
should ideally be reserved at the call site (e.g., amdgpu_userq_vm_
validate_and_restore_queue()). This patch is needed as a workaround
in the meantime

Signed-off-by: Prike Liang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index 93307cbf55dc..11ae2558f3fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
@@ -126,9 +126,13 @@ int amdgpu_evf_mgr_attach_fence(struct 
amdgpu_eviction_fence_mgr *evf_mgr,
 
                amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);
                ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
-               if (!ret)
-                       dma_resv_add_fence(resv, ev_fence,
-                                          DMA_RESV_USAGE_BOOKKEEP);
+               if (!ret) {
+                       /*TODO: Figure out where the reserve fence slots are 
missing. */
+                       ret = dma_resv_reserve_fences(resv, 1);
+                       if (!ret)
+                               dma_resv_add_fence(resv, ev_fence,
+                                                  DMA_RESV_USAGE_BOOKKEEP);
+               }
        } else {
                ret = 0;
        }
-- 
2.34.1

Reply via email to