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: 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-56-airlied@gmail.com
This commit is contained in:
parent
a751612d4c
commit
90a0489a71
|
@ -146,7 +146,7 @@ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)
|
|||
struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man);
|
||||
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);
|
||||
if (ret)
|
||||
|
|
|
@ -223,7 +223,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)
|
|||
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
|
||||
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);
|
||||
if (ret)
|
||||
|
|
|
@ -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);
|
||||
|
||||
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_cleanup(man);
|
||||
ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL);
|
||||
|
@ -253,7 +253,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm)
|
|||
drm->agp.bridge)
|
||||
ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT);
|
||||
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_cleanup(man);
|
||||
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,
|
|||
void ttm_mem_type_manager_debug(struct ttm_mem_type_manager *man,
|
||||
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_tt: %d\n", man->use_tt);
|
||||
drm_printf(p, " size: %llu\n", man->size);
|
||||
|
@ -1001,7 +1000,7 @@ static int ttm_bo_mem_placement(struct ttm_buffer_object *bo,
|
|||
return ret;
|
||||
|
||||
man = ttm_manager_type(bdev, mem_type);
|
||||
if (!man->has_type || !man->use_type)
|
||||
if (!man || !man->use_type)
|
||||
return -EBUSY;
|
||||
|
||||
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)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!man->has_type) {
|
||||
if (!man) {
|
||||
pr_err("Memory type %u has not been initialized\n", mem_type);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1474,7 +1473,6 @@ void ttm_mem_type_manager_init(struct ttm_mem_type_manager *man,
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
BUG_ON(man->has_type);
|
||||
man->use_io_reserve_lru = false;
|
||||
mutex_init(&man->io_reserve_mutex);
|
||||
spin_lock_init(&man->move_lock);
|
||||
|
@ -1555,7 +1553,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
|
|||
struct ttm_mem_type_manager *man;
|
||||
|
||||
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);
|
||||
|
||||
mutex_lock(&ttm_global_mutex);
|
||||
|
|
|
@ -152,7 +152,7 @@ int ttm_range_man_fini(struct ttm_bo_device *bdev,
|
|||
struct drm_mm *mm = &rman->mm;
|
||||
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);
|
||||
if (ret)
|
||||
|
|
|
@ -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 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);
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ void vmw_thp_fini(struct vmw_private *dev_priv)
|
|||
struct drm_mm *mm = &rman->mm;
|
||||
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);
|
||||
if (ret)
|
||||
|
|
|
@ -111,7 +111,6 @@ struct ttm_mem_type_manager_func {
|
|||
/**
|
||||
* struct ttm_mem_type_manager
|
||||
*
|
||||
* @has_type: The memory type has been initialized.
|
||||
* @use_type: The memory type is enabled.
|
||||
* @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
|
||||
* managed by this memory type.
|
||||
|
@ -141,8 +140,6 @@ struct ttm_mem_type_manager {
|
|||
/*
|
||||
* No protection. Constant from start.
|
||||
*/
|
||||
|
||||
bool has_type;
|
||||
bool use_type;
|
||||
bool use_tt;
|
||||
uint64_t size;
|
||||
|
@ -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)
|
||||
{
|
||||
man->has_type = true;
|
||||
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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue