Commit 37bff654 authored by Dave Airlie's avatar Dave Airlie

drm/ttm: move unbind into the tt destroy.

This moves unbind into the driver side on destroy paths.
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/20200917043040.146575-4-airlied@gmail.com
parent 7626168f
...@@ -1267,6 +1267,7 @@ static void amdgpu_ttm_backend_destroy(struct ttm_bo_device *bdev, ...@@ -1267,6 +1267,7 @@ static void amdgpu_ttm_backend_destroy(struct ttm_bo_device *bdev,
{ {
struct amdgpu_ttm_tt *gtt = (void *)ttm; struct amdgpu_ttm_tt *gtt = (void *)ttm;
amdgpu_ttm_backend_unbind(bdev, ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
if (gtt->usertask) if (gtt->usertask)
put_task_struct(gtt->usertask); put_task_struct(gtt->usertask);
......
...@@ -1372,6 +1372,7 @@ nouveau_ttm_tt_destroy(struct ttm_bo_device *bdev, ...@@ -1372,6 +1372,7 @@ nouveau_ttm_tt_destroy(struct ttm_bo_device *bdev,
#if IS_ENABLED(CONFIG_AGP) #if IS_ENABLED(CONFIG_AGP)
struct nouveau_drm *drm = nouveau_bdev(bdev); struct nouveau_drm *drm = nouveau_bdev(bdev);
if (drm->agp.bridge) { if (drm->agp.bridge) {
ttm_agp_unbind(ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
ttm_agp_destroy(ttm); ttm_agp_destroy(ttm);
return; return;
......
...@@ -20,6 +20,7 @@ nouveau_sgdma_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm) ...@@ -20,6 +20,7 @@ nouveau_sgdma_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
if (ttm) { if (ttm) {
nouveau_sgdma_unbind(bdev, ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
ttm_dma_tt_fini(&nvbe->ttm); ttm_dma_tt_fini(&nvbe->ttm);
kfree(nvbe); kfree(nvbe);
......
...@@ -576,6 +576,7 @@ static void radeon_ttm_backend_destroy(struct ttm_bo_device *bdev, struct ttm_tt ...@@ -576,6 +576,7 @@ static void radeon_ttm_backend_destroy(struct ttm_bo_device *bdev, struct ttm_tt
{ {
struct radeon_ttm_tt *gtt = (void *)ttm; struct radeon_ttm_tt *gtt = (void *)ttm;
radeon_ttm_backend_unbind(bdev, ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
ttm_dma_tt_fini(&gtt->ttm); ttm_dma_tt_fini(&gtt->ttm);
...@@ -757,6 +758,7 @@ static void radeon_ttm_tt_destroy(struct ttm_bo_device *bdev, ...@@ -757,6 +758,7 @@ static void radeon_ttm_tt_destroy(struct ttm_bo_device *bdev,
struct radeon_device *rdev = radeon_get_rdev(bdev); struct radeon_device *rdev = radeon_get_rdev(bdev);
if (rdev->flags & RADEON_IS_AGP) { if (rdev->flags & RADEON_IS_AGP) {
ttm_agp_unbind(ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
ttm_agp_destroy(ttm); ttm_agp_destroy(ttm);
return; return;
......
...@@ -1619,7 +1619,6 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo) ...@@ -1619,7 +1619,6 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
if (bo->ttm == NULL) if (bo->ttm == NULL)
return; return;
ttm_bo_tt_unbind(bo);
ttm_tt_destroy(bo->bdev, bo->ttm); ttm_tt_destroy(bo->bdev, bo->ttm);
bo->ttm = NULL; bo->ttm = NULL;
} }
......
...@@ -636,6 +636,7 @@ static void vmw_ttm_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm) ...@@ -636,6 +636,7 @@ static void vmw_ttm_destroy(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
struct vmw_ttm_tt *vmw_be = struct vmw_ttm_tt *vmw_be =
container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm); container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
vmw_ttm_unbind(bdev, ttm);
ttm_tt_destroy_common(bdev, ttm); ttm_tt_destroy_common(bdev, ttm);
vmw_ttm_unmap_dma(vmw_be); vmw_ttm_unmap_dma(vmw_be);
if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent) if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent)
......
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