diff options
author | Dave Airlie <airlied@redhat.com> | 2020-08-04 12:55:46 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-08-06 12:31:29 +1000 |
commit | 747074bb04b5a6be8e562d06b5a312d6ddb253d0 (patch) | |
tree | 7487a788034d14dd2dd499aafc85cb7880d99fcd /drivers/gpu/drm | |
parent | e22054debc079ed1c9db7561b8efda43a078fbe0 (diff) |
drm/ttm: split the mm manager init code (v2)
This will allow the driver to control the ordering here better.
Eventually the old path will be removed.
v2: add docs for new APIs.
rename new path to ttm_mem_type_manager_init/set_used(for now)
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-14-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 8cd012f6bba2..ebc850ce1273 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1507,35 +1507,41 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type) } EXPORT_SYMBOL(ttm_bo_evict_mm); -int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, - unsigned long p_size) +void ttm_mem_type_manager_init(struct ttm_bo_device *bdev, + struct ttm_mem_type_manager *man, + unsigned long p_size) { - int ret; - struct ttm_mem_type_manager *man; unsigned i; - BUG_ON(type >= TTM_NUM_MEM_TYPES); - man = &bdev->man[type]; BUG_ON(man->has_type); man->use_io_reserve_lru = false; mutex_init(&man->io_reserve_mutex); spin_lock_init(&man->move_lock); INIT_LIST_HEAD(&man->io_reserve_lru); man->bdev = bdev; - - if (type != TTM_PL_SYSTEM) { - ret = (*man->func->init)(man, p_size); - if (ret) - return ret; - } - man->has_type = true; - man->use_type = true; man->size = p_size; for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) INIT_LIST_HEAD(&man->lru[i]); man->move = NULL; +} +EXPORT_SYMBOL(ttm_mem_type_manager_init); +int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, + unsigned long p_size) +{ + int ret; + struct ttm_mem_type_manager *man; + + BUG_ON(type >= TTM_NUM_MEM_TYPES); + ttm_mem_type_manager_init(bdev, &bdev->man[type], p_size); + + if (type != TTM_PL_SYSTEM) { + ret = (*man->func->init)(man, p_size); + if (ret) + return ret; + } + ttm_mem_type_manager_set_used(man, true); return 0; } EXPORT_SYMBOL(ttm_bo_init_mm); |