When creating a BO that shares the VM root PD's resv, TTM eviction
fences are added to the resv, and there is another fence added for the
BO clear job.

Fixes: 897ee11ec020 ("drm/amdgpu: create multiple clear/move ttm entities")
Signed-off-by: Benjamin Cheng <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 9da7ae6b9ef3..eb7473ed9e0e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -504,6 +504,14 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void 
*data,
                if (r)
                        return r;
 
+               /* ttm_bo_init_reserved() + clear fence */
+               r = dma_resv_reserve_fences(vm->root.bo->tbo.base.resv,
+                                           TTM_NUM_MOVE_FENCES + 1);
+               if (r) {
+                       amdgpu_bo_unreserve(vm->root.bo);
+                       return r;
+               }
+
                resv = vm->root.bo->tbo.base.resv;
        }
 
-- 
2.56.1

Reply via email to