Skip to content

Commit

Permalink
drm/ttm: remove default caching
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
Christian König committed Sep 15, 2020
1 parent 46f2063 commit 0fe438c
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 39 deletions.
1 change: 0 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/drm/drm_gem_vram_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
21 changes: 7 additions & 14 deletions drivers/gpu/drm/nouveau/nouveau_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}
Expand All @@ -245,25 +242,22 @@ 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;
else if (!drm->agp.bridge)
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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/qxl/qxl_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions drivers/gpu/drm/radeon/radeon_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/ttm/ttm_range_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/ttm/ttm_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions include/drm/ttm/ttm_bo_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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);

Expand Down
3 changes: 0 additions & 3 deletions include/drm/ttm/ttm_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;

Expand Down

0 comments on commit 0fe438c

Please sign in to comment.