Commit 2ff6e69c authored by Dave Airlie's avatar Dave Airlie

drm/ttm: wrap tt destroy. (v2)

All places this was called was using bo->ttm either direct
or indirectly.

v2: move to ttm_bo
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-3-airlied@gmail.com
parent 7eec9151
No related merge requests found
...@@ -301,10 +301,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ...@@ -301,10 +301,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
out_err: out_err:
new_man = ttm_manager_type(bdev, bo->mem.mem_type); new_man = ttm_manager_type(bdev, bo->mem.mem_type);
if (!new_man->use_tt) { if (!new_man->use_tt)
ttm_tt_destroy(bdev, bo->ttm); ttm_bo_tt_destroy(bo);
bo->ttm = NULL;
}
return ret; return ret;
} }
...@@ -322,8 +320,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) ...@@ -322,8 +320,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
if (bo->bdev->driver->move_notify) if (bo->bdev->driver->move_notify)
bo->bdev->driver->move_notify(bo, false, NULL); bo->bdev->driver->move_notify(bo, false, NULL);
ttm_tt_destroy(bo->bdev, bo->ttm); ttm_bo_tt_destroy(bo);
bo->ttm = NULL;
ttm_resource_free(bo, &bo->mem); ttm_resource_free(bo, &bo->mem);
} }
...@@ -1613,3 +1610,9 @@ void ttm_bo_swapout_all(void) ...@@ -1613,3 +1610,9 @@ void ttm_bo_swapout_all(void)
while (ttm_bo_swapout(&ttm_bo_glob, &ctx) == 0); while (ttm_bo_swapout(&ttm_bo_glob, &ctx) == 0);
} }
EXPORT_SYMBOL(ttm_bo_swapout_all); EXPORT_SYMBOL(ttm_bo_swapout_all);
void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
{
ttm_tt_destroy(bo->bdev, bo->ttm);
bo->ttm = NULL;
}
...@@ -297,10 +297,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, ...@@ -297,10 +297,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
*old_mem = *new_mem; *old_mem = *new_mem;
new_mem->mm_node = NULL; new_mem->mm_node = NULL;
if (!man->use_tt) { if (!man->use_tt)
ttm_tt_destroy(bdev, ttm); ttm_bo_tt_destroy(bo);
bo->ttm = NULL;
}
out1: out1:
ttm_resource_iounmap(bdev, old_mem, new_iomap); ttm_resource_iounmap(bdev, old_mem, new_iomap);
...@@ -542,10 +540,8 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, ...@@ -542,10 +540,8 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
if (ret) if (ret)
return ret; return ret;
if (!man->use_tt) { if (!man->use_tt)
ttm_tt_destroy(bdev, bo->ttm); ttm_bo_tt_destroy(bo);
bo->ttm = NULL;
}
ttm_bo_free_old_node(bo); ttm_bo_free_old_node(bo);
} else { } else {
/** /**
...@@ -665,10 +661,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo, ...@@ -665,10 +661,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
if (ret) if (ret)
return ret; return ret;
if (!to->use_tt) { if (!to->use_tt)
ttm_tt_destroy(bdev, bo->ttm); ttm_bo_tt_destroy(bo);
bo->ttm = NULL;
}
ttm_bo_free_old_node(bo); ttm_bo_free_old_node(bo);
} }
......
...@@ -684,6 +684,11 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo); ...@@ -684,6 +684,11 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);
*/ */
pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
/**
* ttm_bo_tt_destroy.
*/
void ttm_bo_tt_destroy(struct ttm_buffer_object *bo);
/** /**
* ttm_range_man_init * ttm_range_man_init
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment