Commit 2ff2bf1e authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v3

We still need to unbind explicitly during a move.

This partial reverts commit ff20caa0bcbfef9f7686f8d1868a3b990921afd6.

v2: remove unnecessary check and unused variable
v3: fix typo in commit message
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarEdward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent bbec97aa
...@@ -53,6 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ...@@ -53,6 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
int ret; int ret;
if (old_mem->mem_type != TTM_PL_SYSTEM) { if (old_mem->mem_type != TTM_PL_SYSTEM) {
ttm_tt_unbind(ttm);
ttm_bo_free_old_node(bo); ttm_bo_free_old_node(bo);
ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM, ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
TTM_PL_MASK_MEM); TTM_PL_MASK_MEM);
......
...@@ -166,16 +166,10 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching); ...@@ -166,16 +166,10 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
void ttm_tt_destroy(struct ttm_tt *ttm) void ttm_tt_destroy(struct ttm_tt *ttm)
{ {
int ret;
if (ttm == NULL) if (ttm == NULL)
return; return;
if (ttm->state == tt_bound) { ttm_tt_unbind(ttm);
ret = ttm->func->unbind(ttm);
BUG_ON(ret);
ttm->state = tt_unbound;
}
if (ttm->state == tt_unbound) if (ttm->state == tt_unbound)
ttm_tt_unpopulate(ttm); ttm_tt_unpopulate(ttm);
...@@ -255,6 +249,17 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma) ...@@ -255,6 +249,17 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
} }
EXPORT_SYMBOL(ttm_dma_tt_fini); EXPORT_SYMBOL(ttm_dma_tt_fini);
void ttm_tt_unbind(struct ttm_tt *ttm)
{
int ret;
if (ttm->state == tt_bound) {
ret = ttm->func->unbind(ttm);
BUG_ON(ret);
ttm->state = tt_unbound;
}
}
int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
{ {
int ret = 0; int ret = 0;
......
...@@ -627,6 +627,15 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); ...@@ -627,6 +627,15 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
*/ */
extern void ttm_tt_destroy(struct ttm_tt *ttm); extern void ttm_tt_destroy(struct ttm_tt *ttm);
/**
* ttm_ttm_unbind:
*
* @ttm: The struct ttm_tt.
*
* Unbind a struct ttm_tt.
*/
extern void ttm_tt_unbind(struct ttm_tt *ttm);
/** /**
* ttm_tt_swapin: * ttm_tt_swapin:
* *
......
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