@@ -683,6 +683,14 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
adev = amdgpu_ttm_adev(bo->bdev);
+ if ((new_mem->mem_type == TTM_PL_TT ||
+ new_mem->mem_type == TTM_PL_SYSTEM) &&
+ old_mem->mem_type == TTM_PL_VRAM) {
+ r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem);
+ if (r)
+ return r;
+ }
+
amdgpu_bo_move_invalidate(abo, evict);
/* remember the eviction */
if (evict)
@@ -1069,6 +1069,14 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
struct nouveau_drm_tile *new_tile = NULL;
int ret = 0;
+ if ((new_reg->mem_type == TTM_PL_TT ||
+ new_reg->mem_type == TTM_PL_SYSTEM) &&
+ old_reg->mem_type == TTM_PL_VRAM) {
+ ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg);
+ if (ret)
+ return ret;
+ }
+
ret = ttm_bo_wait_ctx(bo, ctx);
if (ret)
return ret;
@@ -322,6 +322,14 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
rbo = container_of(bo, struct radeon_bo, tbo);
+ if ((new_mem->mem_type == TTM_PL_TT ||
+ new_mem->mem_type == TTM_PL_SYSTEM) &&
+ old_mem->mem_type == TTM_PL_VRAM) {
+ r = radeon_ttm_tt_bind(bo->bdev, bo->ttm, new_mem);
+ if (r)
+ return r;
+ }
+
radeon_bo_invalidate(rbo);
radeon_bo_memory_usage(rbo, bo->mem.mem_type, new_mem->mem_type);
@@ -103,12 +103,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
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;
}
@@ -731,6 +731,11 @@ static int vmw_move(struct ttm_buffer_object *bo,
struct ttm_resource_manager *new_man = ttm_manager_type(bo->bdev, new_mem->mem_type);
int ret;
+ if (new_man->use_tt && bo->mem.mem_type != TTM_PL_SYSTEM) {
+ ret = vmw_ttm_bind(bo->bdev, bo->ttm, new_mem);
+ if (ret)
+ return ret;
+ }
vmw_move_notify(bo, new_mem);
if (old_man->use_tt && new_man->use_tt) {
if (bo->mem.mem_type == TTM_PL_SYSTEM) {