drm/ttm: remove default caching
authorChristian König <christian.koenig@amd.com>
Fri, 11 Sep 2020 13:06:53 +0000 (15:06 +0200)
committerChristian König <christian.koenig@amd.com>
Tue, 15 Sep 2020 14:03:44 +0000 (16:03 +0200)
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/
15 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
drivers/gpu/drm/drm_gem_vram_helper.c
drivers/gpu/drm/nouveau/nouveau_ttm.c
drivers/gpu/drm/qxl/qxl_ttm.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_range_manager.c
drivers/gpu/drm/ttm/ttm_resource.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
include/drm/ttm/ttm_bo_driver.h
include/drm/ttm/ttm_resource.h

index 2b1b7c1..12d6a01 100644 (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);
 
index 6fc3af0..15ce752 100644 (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);
 }
 
index b2adc2a..f809d84 100644 (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);
 
index 4291f0b..fff42bb 100644 (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;
 
index a62f37b..cf18f75 100644 (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);
index 5ffc8b7..d39d799 100644 (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)
index 602a591..b8e60b3 100644 (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,
index e2bfe3a..43c0a5f 100644 (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);
index 770c898..c80d9fa 100644 (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;
index 3a4602f..80e10c2 100644 (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);
 }
index e600128..1020c99 100644 (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;
index bb76acb..2d81a27 100644 (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);
index 3c00a9e..b6cf576 100644 (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);
index 303a89d..bf000d6 100644 (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);
 
index 7b8a315..a6ae4bf 100644 (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;