summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_bo_manager.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-08-04 05:55:59 +0300
committerDave Airlie <airlied@redhat.com>2020-08-06 05:32:03 +0300
commit56ee8b1c71ffb556b8758f2d9e3098f4f80b4d01 (patch)
tree262168e918b9a26fd69dc9fa01b4a6a9cdd11c93 /drivers/gpu/drm/ttm/ttm_bo_manager.c
parent4265accbfc724a68894f91737e765e2cce43fe4e (diff)
downloadlinux-56ee8b1c71ffb556b8758f2d9e3098f4f80b4d01.tar.xz
drm/ttm: start allowing drivers to use new takedown path (v2)
Allow the takedown path callback to be optional as well. v2: use fini for range manager Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-27-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo_manager.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_manager.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index b56c6961b278..96da22be672b 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -129,7 +129,7 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
}
EXPORT_SYMBOL(ttm_range_man_init);
-static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
+static int ttm_bo_man_takedown_private(struct ttm_mem_type_manager *man)
{
struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
struct drm_mm *mm = &rman->mm;
@@ -146,6 +146,23 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
return -EBUSY;
}
+int ttm_range_man_fini(struct ttm_bo_device *bdev,
+ struct ttm_mem_type_manager *man)
+{
+ int ret;
+
+ ttm_mem_type_manager_disable(man);
+
+ ret = ttm_mem_type_manager_force_list_clean(bdev, man);
+ if (ret)
+ return ret;
+
+ ttm_bo_man_takedown_private(man);
+ ttm_mem_type_manager_cleanup(man);
+ return 0;
+}
+EXPORT_SYMBOL(ttm_range_man_fini);
+
static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
struct drm_printer *printer)
{
@@ -157,7 +174,7 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
}
static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
- .takedown = ttm_bo_man_takedown,
+ .takedown = ttm_bo_man_takedown_private,
.get_node = ttm_bo_man_get_node,
.put_node = ttm_bo_man_put_node,
.debug = ttm_bo_man_debug