drm/ttm: remove default caching

As far as I can tell this was never used either and we just
always fallback to the order cached > wc > uncached anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/390142/
This commit is contained in:
Christian König 2020-09-11 15:06:53 +02:00
parent 46f206304d
commit 0fe438cec9
15 changed files with 14 additions and 39 deletions

View File

@ -96,7 +96,6 @@ int amdgpu_gtt_mgr_init(struct amdgpu_device *adev, uint64_t gtt_size)
man->use_tt = true;
man->func = &amdgpu_gtt_mgr_func;
man->available_caching = TTM_PL_MASK_CACHING;
man->default_caching = TTM_PL_FLAG_CACHED;
ttm_resource_manager_init(man, gtt_size >> PAGE_SHIFT);

View File

@ -68,7 +68,7 @@ static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
uint64_t size)
{
return ttm_range_man_init(&adev->mman.bdev, type,
TTM_PL_FLAG_UNCACHED, TTM_PL_FLAG_UNCACHED,
TTM_PL_FLAG_UNCACHED,
false, size >> PAGE_SHIFT);
}

View File

@ -180,7 +180,6 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
int ret;
man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
man->default_caching = TTM_PL_FLAG_WC;
ttm_resource_manager_init(man, adev->gmc.real_vram_size >> PAGE_SHIFT);

View File

@ -1058,8 +1058,7 @@ static int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
ret = ttm_range_man_init(&vmm->bdev, TTM_PL_VRAM,
TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
TTM_PL_FLAG_WC, false,
vram_size >> PAGE_SHIFT);
false, vram_size >> PAGE_SHIFT);
if (ret)
return ret;

View File

@ -203,12 +203,9 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
return -ENOMEM;
man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
man->default_caching = TTM_PL_FLAG_WC;
if (type & NVIF_MEM_UNCACHED) {
if (type & NVIF_MEM_UNCACHED)
man->available_caching = TTM_PL_FLAG_UNCACHED;
man->default_caching = TTM_PL_FLAG_UNCACHED;
}
man->func = &nouveau_vram_manager;
@ -220,7 +217,7 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm)
} else {
return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_VRAM,
TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
TTM_PL_FLAG_WC, false,
false,
drm->gem.vram_available >> PAGE_SHIFT);
}
}
@ -245,16 +242,14 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
{
struct ttm_resource_manager *man;
unsigned long size_pages = drm->gem.gart_available >> PAGE_SHIFT;
unsigned available_caching, default_caching;
const struct ttm_resource_manager_func *func = NULL;
if (drm->agp.bridge) {
unsigned available_caching;
if (drm->agp.bridge)
available_caching = TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_WC;
default_caching = TTM_PL_FLAG_WC;
} else {
else
available_caching = TTM_PL_MASK_CACHING;
default_caching = TTM_PL_FLAG_CACHED;
}
if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA)
func = &nouveau_gart_manager;
@ -262,8 +257,7 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
func = &nv04_gart_manager;
else
return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_TT,
available_caching, default_caching,
true,
available_caching, true,
size_pages);
man = kzalloc(sizeof(*man), GFP_KERNEL);
@ -272,7 +266,6 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm)
man->func = func;
man->available_caching = available_caching;
man->default_caching = default_caching;
man->use_tt = true;
ttm_resource_manager_init(man, size_pages);
ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, man);

View File

@ -203,7 +203,7 @@ static int qxl_ttm_init_mem_type(struct qxl_device *qdev,
uint64_t size)
{
return ttm_range_man_init(&qdev->mman.bdev, type, TTM_PL_MASK_CACHING,
TTM_PL_FLAG_CACHED, false, size);
false, size);
}
int qxl_ttm_init(struct qxl_device *qdev)

View File

@ -70,16 +70,14 @@ static int radeon_ttm_init_vram(struct radeon_device *rdev)
{
return ttm_range_man_init(&rdev->mman.bdev, TTM_PL_VRAM,
TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC,
TTM_PL_FLAG_WC, false,
rdev->mc.real_vram_size >> PAGE_SHIFT);
false, rdev->mc.real_vram_size >> PAGE_SHIFT);
}
static int radeon_ttm_init_gtt(struct radeon_device *rdev)
{
return ttm_range_man_init(&rdev->mman.bdev, TTM_PL_TT,
TTM_PL_MASK_CACHING,
TTM_PL_FLAG_CACHED, true,
rdev->mc.gtt_size >> PAGE_SHIFT);
true, rdev->mc.gtt_size >> PAGE_SHIFT);
}
static void radeon_evict_flags(struct ttm_buffer_object *bo,

View File

@ -876,8 +876,6 @@ static uint32_t ttm_bo_select_caching(struct ttm_resource_manager *man,
if ((cur_placement & caching) != 0)
result |= (cur_placement & caching);
else if ((man->default_caching & caching) != 0)
result |= man->default_caching;
else if ((TTM_PL_FLAG_CACHED & caching) != 0)
result |= TTM_PL_FLAG_CACHED;
else if ((TTM_PL_FLAG_WC & caching) != 0)
@ -1435,7 +1433,6 @@ static void ttm_bo_init_sysman(struct ttm_bo_device *bdev)
*/
man->use_tt = true;
man->available_caching = TTM_PL_MASK_CACHING;
man->default_caching = TTM_PL_FLAG_CACHED;
ttm_resource_manager_init(man, 0);
ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man);

View File

@ -115,7 +115,6 @@ static const struct ttm_resource_manager_func ttm_range_manager_func;
int ttm_range_man_init(struct ttm_bo_device *bdev,
unsigned type,
uint32_t available_caching,
uint32_t default_caching,
bool use_tt,
unsigned long p_size)
{
@ -128,7 +127,6 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
man = &rman->manager;
man->available_caching = available_caching;
man->default_caching = default_caching;
man->use_tt = use_tt;
man->func = &ttm_range_manager_func;

View File

@ -141,7 +141,6 @@ void ttm_resource_manager_debug(struct ttm_resource_manager *man,
drm_printf(p, " use_tt: %d\n", man->use_tt);
drm_printf(p, " size: %llu\n", man->size);
drm_printf(p, " available_caching: 0x%08X\n", man->available_caching);
drm_printf(p, " default_caching: 0x%08X\n", man->default_caching);
if (man->func && man->func->debug)
(*man->func->debug)(man, p);
}

View File

@ -627,8 +627,8 @@ static int vmw_vram_manager_init(struct vmw_private *dev_priv)
ret = vmw_thp_init(dev_priv);
#else
ret = ttm_range_man_init(&dev_priv->bdev, TTM_PL_VRAM,
TTM_PL_FLAG_CACHED, TTM_PL_FLAG_CACHED,
false, dev_priv->vram_size >> PAGE_SHIFT);
TTM_PL_FLAG_CACHED, false,
dev_priv->vram_size >> PAGE_SHIFT);
#endif
ttm_resource_manager_set_used(ttm_manager_type(&dev_priv->bdev, TTM_PL_VRAM), false);
return ret;

View File

@ -113,7 +113,6 @@ int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type)
man->func = &vmw_gmrid_manager_func;
man->available_caching = TTM_PL_FLAG_CACHED;
man->default_caching = TTM_PL_FLAG_CACHED;
/* TODO: This is most likely not correct */
man->use_tt = true;
ttm_resource_manager_init(man, 0);

View File

@ -132,7 +132,6 @@ int vmw_thp_init(struct vmw_private *dev_priv)
man = &rman->manager;
man->available_caching = TTM_PL_FLAG_CACHED;
man->default_caching = TTM_PL_FLAG_CACHED;
ttm_resource_manager_init(man,
dev_priv->vram_size >> PAGE_SHIFT);

View File

@ -690,7 +690,6 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
* @bdev: ttm device
* @type: memory manager type
* @available_caching: TTM_PL_FLAG_* for allowed caching modes
* @default_caching: default caching mode
* @use_tt: if the memory manager uses tt
* @p_size: size of area to be managed in pages.
*
@ -700,7 +699,6 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
int ttm_range_man_init(struct ttm_bo_device *bdev,
unsigned type,
uint32_t available_caching,
uint32_t default_caching,
bool use_tt,
unsigned long p_size);

View File

@ -110,8 +110,6 @@ struct ttm_resource_manager_func {
* @size: Size of the managed region.
* @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
* as defined in ttm_placement_common.h
* @default_caching: The default caching policy used for a buffer object
* placed in this memory type if the user doesn't provide one.
* @func: structure pointer implementing the range manager. See above
* @move_lock: lock for move fence
* static information. bdev::driver::io_mem_free is never used.
@ -128,7 +126,6 @@ struct ttm_resource_manager {
bool use_tt;
uint64_t size;
uint32_t available_caching;
uint32_t default_caching;
const struct ttm_resource_manager_func *func;
spinlock_t move_lock;