Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Christian König and committed by
Alex Deucher
2ff2bf1e bbec97aa

+22 -7
+1
drivers/gpu/drm/ttm/ttm_bo_util.c
··· 53 53 int ret; 54 54 55 55 if (old_mem->mem_type != TTM_PL_SYSTEM) { 56 + ttm_tt_unbind(ttm); 56 57 ttm_bo_free_old_node(bo); 57 58 ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM, 58 59 TTM_PL_MASK_MEM);
+12 -7
drivers/gpu/drm/ttm/ttm_tt.c
··· 166 166 167 167 void ttm_tt_destroy(struct ttm_tt *ttm) 168 168 { 169 - int ret; 170 - 171 169 if (ttm == NULL) 172 170 return; 173 171 174 - if (ttm->state == tt_bound) { 175 - ret = ttm->func->unbind(ttm); 176 - BUG_ON(ret); 177 - ttm->state = tt_unbound; 178 - } 172 + ttm_tt_unbind(ttm); 179 173 180 174 if (ttm->state == tt_unbound) 181 175 ttm_tt_unpopulate(ttm); ··· 248 254 ttm_dma->dma_address = NULL; 249 255 } 250 256 EXPORT_SYMBOL(ttm_dma_tt_fini); 257 + 258 + void ttm_tt_unbind(struct ttm_tt *ttm) 259 + { 260 + int ret; 261 + 262 + if (ttm->state == tt_bound) { 263 + ret = ttm->func->unbind(ttm); 264 + BUG_ON(ret); 265 + ttm->state = tt_unbound; 266 + } 267 + } 251 268 252 269 int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) 253 270 {
+9
include/drm/ttm/ttm_bo_driver.h
··· 628 628 extern void ttm_tt_destroy(struct ttm_tt *ttm); 629 629 630 630 /** 631 + * ttm_ttm_unbind: 632 + * 633 + * @ttm: The struct ttm_tt. 634 + * 635 + * Unbind a struct ttm_tt. 636 + */ 637 + extern void ttm_tt_unbind(struct ttm_tt *ttm); 638 + 639 + /** 631 640 * ttm_tt_swapin: 632 641 * 633 642 * @ttm: The struct ttm_tt.