Commit 90a0489a authored by Dave Airlie's avatar Dave Airlie

drm/ttm: drop type manager has_type

under driver control, this flag isn't needed anymore,
remove the API that used to access it, and consoldiate
with the used api.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-56-airlied@gmail.com
parent a751612d
...@@ -146,7 +146,7 @@ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev) ...@@ -146,7 +146,7 @@ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)
struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man); struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man);
int ret; int ret;
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man); ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man);
if (ret) if (ret)
......
...@@ -223,7 +223,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev) ...@@ -223,7 +223,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
int ret; int ret;
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man); ret = ttm_mem_type_manager_force_list_clean(&adev->mman.bdev, man);
if (ret) if (ret)
......
...@@ -194,7 +194,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm) ...@@ -194,7 +194,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm)
struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM); struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man); ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
ttm_mem_type_manager_cleanup(man); ttm_mem_type_manager_cleanup(man);
ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL); ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL);
...@@ -253,7 +253,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm) ...@@ -253,7 +253,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
drm->agp.bridge) drm->agp.bridge)
ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT); ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT);
else { else {
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man); ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man);
ttm_mem_type_manager_cleanup(man); ttm_mem_type_manager_cleanup(man);
ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, NULL); ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, NULL);
......
...@@ -80,7 +80,6 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place, ...@@ -80,7 +80,6 @@ static inline int ttm_mem_type_from_place(const struct ttm_place *place,
void ttm_mem_type_manager_debug(struct ttm_mem_type_manager *man, void ttm_mem_type_manager_debug(struct ttm_mem_type_manager *man,
struct drm_printer *p) struct drm_printer *p)
{ {
drm_printf(p, " has_type: %d\n", man->has_type);
drm_printf(p, " use_type: %d\n", man->use_type); drm_printf(p, " use_type: %d\n", man->use_type);
drm_printf(p, " use_tt: %d\n", man->use_tt); drm_printf(p, " use_tt: %d\n", man->use_tt);
drm_printf(p, " size: %llu\n", man->size); drm_printf(p, " size: %llu\n", man->size);
...@@ -1001,7 +1000,7 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo, ...@@ -1001,7 +1000,7 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo,
return ret; return ret;
man = ttm_manager_type(bdev, mem_type); man = ttm_manager_type(bdev, mem_type);
if (!man->has_type || !man->use_type) if (!man || !man->use_type)
return -EBUSY; return -EBUSY;
if (!ttm_bo_mt_compatible(man, mem_type, place, &cur_flags)) if (!ttm_bo_mt_compatible(man, mem_type, place, &cur_flags))
...@@ -1460,7 +1459,7 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type) ...@@ -1460,7 +1459,7 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type)
return -EINVAL; return -EINVAL;
} }
if (!man->has_type) { if (!man) {
pr_err("Memory type %u has not been initialized\n", mem_type); pr_err("Memory type %u has not been initialized\n", mem_type);
return 0; return 0;
} }
...@@ -1474,7 +1473,6 @@ void ttm_mem_type_manager_init(struct ttm_mem_type_manager *man, ...@@ -1474,7 +1473,6 @@ void ttm_mem_type_manager_init(struct ttm_mem_type_manager *man,
{ {
unsigned i; unsigned i;
BUG_ON(man->has_type);
man->use_io_reserve_lru = false; man->use_io_reserve_lru = false;
mutex_init(&man->io_reserve_mutex); mutex_init(&man->io_reserve_mutex);
spin_lock_init(&man->move_lock); spin_lock_init(&man->move_lock);
...@@ -1555,7 +1553,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) ...@@ -1555,7 +1553,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
struct ttm_mem_type_manager *man; struct ttm_mem_type_manager *man;
man = ttm_manager_type(bdev, TTM_PL_SYSTEM); man = ttm_manager_type(bdev, TTM_PL_SYSTEM);
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL);
mutex_lock(&ttm_global_mutex); mutex_lock(&ttm_global_mutex);
......
...@@ -152,7 +152,7 @@ int ttm_range_man_fini(struct ttm_bo_device *bdev, ...@@ -152,7 +152,7 @@ int ttm_range_man_fini(struct ttm_bo_device *bdev,
struct drm_mm *mm = &rman->mm; struct drm_mm *mm = &rman->mm;
int ret; int ret;
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(bdev, man); ret = ttm_mem_type_manager_force_list_clean(bdev, man);
if (ret) if (ret)
......
...@@ -143,7 +143,7 @@ void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type) ...@@ -143,7 +143,7 @@ void vmw_gmrid_man_fini(struct vmw_private *dev_priv, int type)
struct ttm_mem_type_manager *man = ttm_manager_type(&dev_priv->bdev, type); struct ttm_mem_type_manager *man = ttm_manager_type(&dev_priv->bdev, type);
struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man); struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man);
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man); ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man);
......
...@@ -152,7 +152,7 @@ void vmw_thp_fini(struct vmw_private *dev_priv) ...@@ -152,7 +152,7 @@ void vmw_thp_fini(struct vmw_private *dev_priv)
struct drm_mm *mm = &rman->mm; struct drm_mm *mm = &rman->mm;
int ret; int ret;
ttm_mem_type_manager_disable(man); ttm_mem_type_manager_set_used(man, false);
ret = ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man); ret = ttm_mem_type_manager_force_list_clean(&dev_priv->bdev, man);
if (ret) if (ret)
......
...@@ -111,7 +111,6 @@ struct ttm_mem_type_manager_func { ...@@ -111,7 +111,6 @@ struct ttm_mem_type_manager_func {
/** /**
* struct ttm_mem_type_manager * struct ttm_mem_type_manager
* *
* @has_type: The memory type has been initialized.
* @use_type: The memory type is enabled. * @use_type: The memory type is enabled.
* @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
* managed by this memory type. * managed by this memory type.
...@@ -141,8 +140,6 @@ struct ttm_mem_type_manager { ...@@ -141,8 +140,6 @@ struct ttm_mem_type_manager {
/* /*
* No protection. Constant from start. * No protection. Constant from start.
*/ */
bool has_type;
bool use_type; bool use_type;
bool use_tt; bool use_tt;
uint64_t size; uint64_t size;
...@@ -689,23 +686,9 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) ...@@ -689,23 +686,9 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
*/ */
static inline void ttm_mem_type_manager_set_used(struct ttm_mem_type_manager *man, bool used) static inline void ttm_mem_type_manager_set_used(struct ttm_mem_type_manager *man, bool used)
{ {
man->has_type = true;
man->use_type = used; man->use_type = used;
} }
/**
* ttm_mem_type_manager_disable.
*
* @man: A memory manager object.
*
* Indicate the manager is not to be used and deregistered. (temporary during rework).
*/
static inline void ttm_mem_type_manager_disable(struct ttm_mem_type_manager *man)
{
man->has_type = false;
man->use_type = false;
}
/** /**
* ttm_mem_type_manager_cleanup * ttm_mem_type_manager_cleanup
* *
......
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