@@ -623,6 +623,10 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
if (unlikely(r)) {
goto out_cleanup;
}
+ r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, &tmp_mem);
+ if (unlikely(r))
+ goto out_cleanup;
+
ttm_bo_assign_mem(bo, &tmp_mem);
/* copy to VRAM */
r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
@@ -958,7 +958,9 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict,
ret = ttm_bo_move_to_new_tt_mem(bo, ctx, &tmp_reg);
if (ret)
goto out;
-
+ ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, &tmp_reg);
+ if (ret)
+ goto out;
ttm_bo_assign_mem(bo, &tmp_reg);
ret = nouveau_bo_move_m2mf(bo, true, ctx, new_reg);
if (ret)
@@ -297,6 +297,10 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
if (unlikely(r)) {
goto out_cleanup;
}
+ r = radeon_ttm_tt_bind(bo->bdev, bo->ttm, &tmp_mem);
+ if (unlikely(r))
+ goto out_cleanup;
+
ttm_bo_assign_mem(bo, &tmp_mem);
r = radeon_move_blit(bo, true, new_mem, old_mem);
if (unlikely(r)) {
@@ -255,6 +255,13 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
ret = ttm_bo_move_to_new_tt_mem(bo, ctx, mem);
if (ret)
goto out_err;
+
+ if (mem->mem_type != TTM_PL_SYSTEM) {
+ ret = ttm_bo_tt_bind(bo, mem);
+ if (ret)
+ goto out_err;
+ }
+
}
ret = bdev->driver->move(bo, evict, ctx, mem);
@@ -60,11 +60,8 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
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;
}
+
return 0;
}
EXPORT_SYMBOL(ttm_bo_move_to_new_tt_mem);
@@ -105,6 +102,13 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem);
if (ret)
return ret;
+
+ if (new_mem->mem_type != TTM_PL_SYSTEM) {
+ ret = ttm_bo_tt_bind(bo, new_mem);
+ if (unlikely(ret != 0))
+ return ret;
+ }
+
ttm_bo_assign_mem(bo, new_mem);
return 0;
}