if (ret)
goto out_err;
- if (mem->mem_type != TTM_PL_SYSTEM) {
- ret = ttm_tt_populate(bdev, bo->ttm, ctx);
- if (ret)
- goto out_err;
-
- ret = ttm_bo_tt_bind(bo, mem);
- if (ret)
- goto out_err;
- }
+ ret = ttm_bo_move_to_new_tt_mem(bo, ctx, mem);
+ if (ret)
+ goto out_err;
}
if (bdev->driver->move_notify)
struct ttm_buffer_object *bo;
};
+int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
+ struct ttm_operation_ctx *ctx,
+ struct ttm_resource *new_mem)
+{
+ int ret;
+
+ if (new_mem->mem_type == TTM_PL_SYSTEM)
+ return 0;
+
+ ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
+ if (unlikely(ret != 0))
+ return ret;
+
+ ret = ttm_bo_tt_bind(bo, new_mem);
+ if (unlikely(ret != 0))
+ return ret;
+
+ return 0;
+}
+
int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
struct ttm_operation_ctx *ctx,
struct ttm_resource *new_mem)
{
- struct ttm_tt *ttm = bo->ttm;
struct ttm_resource *old_mem = &bo->mem;
int ret;
old_mem->mem_type = TTM_PL_SYSTEM;
}
- if (new_mem->mem_type != TTM_PL_SYSTEM) {
-
- ret = ttm_tt_populate(bo->bdev, ttm, ctx);
- if (unlikely(ret != 0))
- return ret;
-
- ret = ttm_bo_tt_bind(bo, new_mem);
- if (unlikely(ret != 0))
- return ret;
- }
+ ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem);
+ if (unlikely(ret != 0))
+ return ret;
ttm_bo_assign_mem(bo, new_mem);
return 0;
struct ttm_operation_ctx *ctx,
struct ttm_resource *new_mem);
+int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
+ struct ttm_operation_ctx *ctx,
+ struct ttm_resource *new_mem);
+
/**
* ttm_bo_move_memcpy
*