diff options
author | Dave Airlie <airlied@redhat.com> | 2020-08-04 04:56:00 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-08-06 04:32:03 +0200 |
commit | 6fe1c54353f926e59f03aaa11c9271aa92fd0982 (patch) | |
tree | f4e747f8f13f9c1f03f85853d2c1cd54c945d629 /drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | |
parent | drm/ttm: start allowing drivers to use new takedown path (v2) (diff) | |
download | linux-6fe1c54353f926e59f03aaa11c9271aa92fd0982.tar.xz linux-6fe1c54353f926e59f03aaa11c9271aa92fd0982.zip |
drm/amdgpu/ttm: use new takedown path
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-28-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c index f94c6a3836a8..699cb0dff351 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c @@ -133,10 +133,18 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size) * Destroy and free the GTT manager, returns -EBUSY if ranges are still * allocated inside it. */ -static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man) +void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev) { - struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev); + struct ttm_mem_type_manager *man = &adev->mman.bdev.man[TTM_PL_TT]; struct amdgpu_gtt_mgr *mgr = man->priv; + int ret; + + ttm_mem_type_manager_disable(man); + + ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man); + if (ret) + return; + spin_lock(&mgr->lock); drm_mm_takedown(&mgr->mm); spin_unlock(&mgr->lock); @@ -146,7 +154,7 @@ static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man) device_remove_file(adev->dev, &dev_attr_mem_info_gtt_total); device_remove_file(adev->dev, &dev_attr_mem_info_gtt_used); - return 0; + ttm_mem_type_manager_cleanup(man); } /** @@ -309,7 +317,6 @@ static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man, } static const struct ttm_mem_type_manager_func amdgpu_gtt_mgr_func = { - .takedown = amdgpu_gtt_mgr_fini, .get_node = amdgpu_gtt_mgr_new, .put_node = amdgpu_gtt_mgr_del, .debug = amdgpu_gtt_mgr_debug |