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

drm/ttm: flip tt destroy ordering.

Call the driver first and have it call the common code cleanup.

This is useful later to fix unbind.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-3-airlied@gmail.com

+22 -1
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 1267 1267 { 1268 1268 struct amdgpu_ttm_tt *gtt = (void *)ttm; 1269 1269 1270 + ttm_tt_destroy_common(bdev, ttm); 1270 1271 if (gtt->usertask) 1271 1272 put_task_struct(gtt->usertask); 1272 1273
+1
drivers/gpu/drm/drm_gem_vram_helper.c
··· 922 922 923 923 static void bo_driver_ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *tt) 924 924 { 925 + ttm_tt_destroy_common(bdev, tt); 925 926 ttm_tt_fini(tt); 926 927 kfree(tt); 927 928 }
+1
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 1372 1372 #if IS_ENABLED(CONFIG_AGP) 1373 1373 struct nouveau_drm *drm = nouveau_bdev(bdev); 1374 1374 if (drm->agp.bridge) { 1375 + ttm_tt_destroy_common(bdev, ttm); 1375 1376 ttm_agp_destroy(ttm); 1376 1377 return; 1377 1378 }
+1
drivers/gpu/drm/nouveau/nouveau_sgdma.c
··· 20 20 struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; 21 21 22 22 if (ttm) { 23 + ttm_tt_destroy_common(bdev, ttm); 23 24 ttm_dma_tt_fini(&nvbe->ttm); 24 25 kfree(nvbe); 25 26 }
+1
drivers/gpu/drm/qxl/qxl_ttm.c
··· 130 130 { 131 131 struct qxl_ttm_tt *gtt = (void *)ttm; 132 132 133 + ttm_tt_destroy_common(bdev, ttm); 133 134 ttm_tt_fini(&gtt->ttm); 134 135 kfree(gtt); 135 136 }
+3
drivers/gpu/drm/radeon/radeon_ttm.c
··· 576 576 { 577 577 struct radeon_ttm_tt *gtt = (void *)ttm; 578 578 579 + ttm_tt_destroy_common(bdev, ttm); 580 + 579 581 ttm_dma_tt_fini(&gtt->ttm); 580 582 kfree(gtt); 581 583 } ··· 757 755 struct radeon_device *rdev = radeon_get_rdev(bdev); 758 756 759 757 if (rdev->flags & RADEON_IS_AGP) { 758 + ttm_tt_destroy_common(bdev, ttm); 760 759 ttm_agp_destroy(ttm); 761 760 return; 762 761 }
+6 -1
drivers/gpu/drm/ttm/ttm_tt.c
··· 207 207 } 208 208 EXPORT_SYMBOL(ttm_tt_set_placement_caching); 209 209 210 - void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm) 210 + void ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm) 211 211 { 212 212 ttm_tt_unpopulate(bdev, ttm); 213 213 ··· 216 216 fput(ttm->swap_storage); 217 217 218 218 ttm->swap_storage = NULL; 219 + } 220 + EXPORT_SYMBOL(ttm_tt_destroy_common); 221 + 222 + void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm) 223 + { 219 224 bdev->driver->ttm_tt_destroy(bdev, ttm); 220 225 } 221 226
+1
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
··· 636 636 struct vmw_ttm_tt *vmw_be = 637 637 container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm); 638 638 639 + ttm_tt_destroy_common(bdev, ttm); 639 640 vmw_ttm_unmap_dma(vmw_be); 640 641 if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent) 641 642 ttm_dma_tt_fini(&vmw_be->dma_ttm);
+7
include/drm/ttm/ttm_tt.h
··· 156 156 void ttm_tt_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm); 157 157 158 158 /** 159 + * ttm_tt_destroy_common: 160 + * 161 + * Called from driver to destroy common path. 162 + */ 163 + void ttm_tt_destroy_common(struct ttm_bo_device *bdev, struct ttm_tt *ttm); 164 + 165 + /** 159 166 * ttm_tt_swapin: 160 167 * 161 168 * @ttm: The struct ttm_tt.