Reserve the move fence space before adding the fence to reserve objection. Signed-off-by: Prike Liang <prike.li...@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index f9a84d07dcbc..d5eab0078360 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -646,9 +646,15 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, return ret; } + ret = dma_resv_reserve_fences(bo->base.resv, 1); + if (ret) { + pr_err("Resv shared move fence space failed\n"); + goto err_resv; + } + dma_resv_add_fence(bo->base.resv, fence, DMA_RESV_USAGE_KERNEL); - ret = dma_resv_reserve_fences(bo->base.resv, 1); +err_resv: dma_fence_put(fence); return ret; } -- 2.34.1