goto out_cleanup;
}
+ r = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
+ if (unlikely(r))
+ goto out_cleanup;
+
/* Bind the memory to the GTT space */
- r = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_mem, ctx);
+ r = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_mem);
if (unlikely(r)) {
goto out_cleanup;
}
if (ret)
return ret;
- ret = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_reg, &ctx);
+ ret = ttm_tt_populate(bo->bdev, bo->ttm, &ctx);
+ if (ret)
+ goto out;
+
+ ret = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_reg);
if (ret)
goto out;
goto out_cleanup;
}
- r = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_mem, &ctx);
+ r = ttm_tt_populate(bo->bdev, bo->ttm, &ctx);
+ if (unlikely(r)) {
+ goto out_cleanup;
+ }
+
+ r = ttm_tt_bind(bo->bdev, bo->ttm, &tmp_mem);
if (unlikely(r)) {
goto out_cleanup;
}
goto out_err;
if (mem->mem_type != TTM_PL_SYSTEM) {
- ret = ttm_tt_bind(bdev, bo->ttm, mem, ctx);
+ ret = ttm_tt_populate(bdev, bo->ttm, ctx);
+ if (ret)
+ goto out_err;
+
+ ret = ttm_tt_bind(bdev, bo->ttm, mem);
if (ret)
goto out_err;
}
return ret;
if (new_mem->mem_type != TTM_PL_SYSTEM) {
- ret = ttm_tt_bind(bo->bdev, ttm, new_mem, ctx);
+
+ ret = ttm_tt_populate(bo->bdev, ttm, ctx);
+ if (unlikely(ret != 0))
+ return ret;
+
+ ret = ttm_tt_bind(bo->bdev, ttm, new_mem);
if (unlikely(ret != 0))
return ret;
}
}
int ttm_tt_bind(struct ttm_bo_device *bdev,
- struct ttm_tt *ttm, struct ttm_resource *bo_mem,
- struct ttm_operation_ctx *ctx)
+ struct ttm_tt *ttm, struct ttm_resource *bo_mem)
{
int ret = 0;
if (ttm_tt_is_bound(ttm))
return 0;
- ret = ttm_tt_populate(bdev, ttm, ctx);
- if (ret)
- return ret;
-
ret = bdev->driver->ttm_tt_bind(bdev, ttm, bo_mem);
if (unlikely(ret != 0))
return ret;
{
int ret;
+ if (!ttm)
+ return -EINVAL;
+
if (ttm_tt_is_populated(ttm))
return 0;
ttm_tt_add_mapping(bdev, ttm);
return ret;
}
+EXPORT_SYMBOL(ttm_tt_populate);
static void ttm_tt_clear_mapping(struct ttm_tt *ttm)
{
* Bind the pages of @ttm to an aperture location identified by @bo_mem
*/
int ttm_tt_bind(struct ttm_bo_device *bdev,
- struct ttm_tt *ttm, struct ttm_resource *bo_mem,
- struct ttm_operation_ctx *ctx);
+ struct ttm_tt *ttm, struct ttm_resource *bo_mem);
/**
* ttm_ttm_destroy: