diff options
author | Dave Airlie <airlied@redhat.com> | 2020-08-04 12:56:19 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-08-06 13:12:39 +1000 |
commit | 37205891d84f9269de61d6e85c24607209478a85 (patch) | |
tree | 64b43845d0885fcdb5d830872d44b74c049d7732 /drivers/gpu/drm/nouveau/nouveau_ttm.c | |
parent | 0af135b892bf06c1a56cb0cd9632feb34511f9ee (diff) |
drm/ttm: make ttm_range_man_init/takedown take type + args
This makes it easier to move these to a driver allocated system
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-47-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_ttm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_ttm.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index cc6cf04553dd..1c636723823c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c @@ -156,16 +156,17 @@ nouveau_ttm_init_host(struct nouveau_drm *drm, u8 kind) static int nouveau_ttm_init_vram(struct nouveau_drm *drm) { - struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM); struct nvif_mmu *mmu = &drm->client.mmu; - man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; - man->default_caching = TTM_PL_FLAG_WC; - if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { + struct ttm_mem_type_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM); + /* Some BARs do not support being ioremapped WC */ const u8 type = mmu->type[drm->ttm.type_vram].type; + man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; + man->default_caching = TTM_PL_FLAG_WC; + if (type & NVIF_MEM_UNCACHED) { man->available_caching = TTM_PL_FLAG_UNCACHED; man->default_caching = TTM_PL_FLAG_UNCACHED; @@ -178,7 +179,9 @@ nouveau_ttm_init_vram(struct nouveau_drm *drm) ttm_mem_type_manager_set_used(man, true); return 0; } else { - return ttm_range_man_init(&drm->ttm.bdev, man, + return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_VRAM, + TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC, + TTM_PL_FLAG_WC, false, drm->gem.vram_available >> PAGE_SHIFT); } } @@ -193,7 +196,7 @@ nouveau_ttm_fini_vram(struct nouveau_drm *drm) ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man); ttm_mem_type_manager_cleanup(man); } else - ttm_range_man_fini(&drm->ttm.bdev, man); + ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_VRAM); } static int @@ -216,9 +219,10 @@ nouveau_ttm_init_gtt(struct nouveau_drm *drm) else if (!drm->agp.bridge) man->func = &nv04_gart_manager; else - return ttm_range_man_init(&drm->ttm.bdev, man, + return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_TT, + TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC, + TTM_PL_FLAG_WC, true, size_pages); - ttm_mem_type_manager_init(&drm->ttm.bdev, man, size_pages); ttm_mem_type_manager_set_used(man, true); @@ -232,7 +236,7 @@ nouveau_ttm_fini_gtt(struct nouveau_drm *drm) if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA && drm->agp.bridge) - ttm_range_man_fini(&drm->ttm.bdev, man); + ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_TT); else { ttm_mem_type_manager_disable(man); ttm_mem_type_manager_force_list_clean(&drm->ttm.bdev, man); |