/Linux-v5.15/drivers/gpu/drm/ttm/ |
D | ttm_tt.c | 65 if (bo->ttm) in ttm_tt_create() 83 bo->ttm = bdev->funcs->ttm_tt_create(bo, page_flags); in ttm_tt_create() 84 if (unlikely(bo->ttm == NULL)) in ttm_tt_create() 93 static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm) in ttm_tt_alloc_page_directory() argument 95 ttm->pages = kvmalloc_array(ttm->num_pages, sizeof(void*), in ttm_tt_alloc_page_directory() 97 if (!ttm->pages) in ttm_tt_alloc_page_directory() 102 static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm) in ttm_dma_tt_alloc_page_directory() argument 104 ttm->pages = kvmalloc_array(ttm->num_pages, in ttm_dma_tt_alloc_page_directory() 105 sizeof(*ttm->pages) + in ttm_dma_tt_alloc_page_directory() 106 sizeof(*ttm->dma_address), in ttm_dma_tt_alloc_page_directory() [all …]
|
D | ttm_agp_backend.c | 45 struct ttm_tt ttm; member 50 int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem) in ttm_agp_bind() argument 52 struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); in ttm_agp_bind() 55 int ret, cached = ttm->caching == ttm_cached; in ttm_agp_bind() 61 mem = agp_allocate_memory(agp_be->bridge, ttm->num_pages, AGP_USER_MEMORY); in ttm_agp_bind() 66 for (i = 0; i < ttm->num_pages; i++) { in ttm_agp_bind() 67 struct page *page = ttm->pages[i]; in ttm_agp_bind() 87 void ttm_agp_unbind(struct ttm_tt *ttm) in ttm_agp_unbind() argument 89 struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); in ttm_agp_unbind() 102 bool ttm_agp_is_bound(struct ttm_tt *ttm) in ttm_agp_is_bound() argument [all …]
|
D | ttm_bo_util.c | 96 struct ttm_tt *ttm = bo->ttm; in ttm_move_memcpy() local 105 if (src_ops->maps_tt && (!ttm || !ttm_tt_is_populated(ttm))) { in ttm_move_memcpy() 106 if (ttm && !(ttm->page_flags & TTM_PAGE_FLAG_ZERO_ALLOC)) in ttm_move_memcpy() 142 struct ttm_tt *ttm = bo->ttm; in ttm_bo_move_memcpy() local 153 if (ttm && ((ttm->page_flags & TTM_PAGE_FLAG_SWAPPED) || in ttm_bo_move_memcpy() 155 ret = ttm_tt_populate(bdev, ttm, ctx); in ttm_bo_move_memcpy() 162 dst_iter = ttm_kmap_iter_tt_init(&_dst_iter.tt, bo->ttm); in ttm_bo_move_memcpy() 168 src_iter = ttm_kmap_iter_tt_init(&_src_iter.tt, bo->ttm); in ttm_bo_move_memcpy() 263 caching = man->use_tt ? bo->ttm->caching : res->bus.caching; in ttm_io_prot() 305 struct ttm_tt *ttm = bo->ttm; in ttm_bo_kmap_ttm() local [all …]
|
D | ttm_bo_vm.c | 165 if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) { in ttm_bo_vm_reserve() 198 struct ttm_tt *ttm = bo->ttm; in ttm_bo_vm_insert_huge() local 209 pfn = page_to_pfn(ttm->pages[page_offset]); in ttm_bo_vm_insert_huge() 218 if (page_to_pfn(ttm->pages[page_offset + i]) != pfn + i) in ttm_bo_vm_insert_huge() 287 struct ttm_tt *ttm = NULL; in ttm_bo_vm_fault_reserved() local 322 ttm = bo->ttm; in ttm_bo_vm_fault_reserved() 323 if (ttm_tt_populate(bdev, bo->ttm, &ctx)) in ttm_bo_vm_fault_reserved() 343 page = ttm->pages[page_offset]; in ttm_bo_vm_fault_reserved() 522 if (unlikely(bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)) { in ttm_bo_vm_access() 523 ret = ttm_tt_swapin(bo->ttm); in ttm_bo_vm_access()
|
D | Makefile | 5 ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ 8 ttm-$(CONFIG_AGP) += ttm_agp_backend.o 10 obj-$(CONFIG_DRM_TTM) += ttm.o
|
D | ttm_bo.c | 191 ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx); in ttm_bo_handle_move_mem() 1153 if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) || in ttm_bo_swapout() 1154 bo->ttm->page_flags & TTM_PAGE_FLAG_SG || in ttm_bo_swapout() 1155 bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED || in ttm_bo_swapout() 1208 if (ttm_tt_is_populated(bo->ttm)) in ttm_bo_swapout() 1209 ret = ttm_tt_swapout(bo->bdev, bo->ttm, gfp_flags); in ttm_bo_swapout() 1224 if (bo->ttm == NULL) in ttm_bo_tt_destroy() 1227 ttm_tt_destroy(bo->bdev, bo->ttm); in ttm_bo_tt_destroy() 1228 bo->ttm = NULL; in ttm_bo_tt_destroy()
|
/Linux-v5.15/drivers/gpu/drm/radeon/ |
D | radeon_ttm.c | 56 static int radeon_ttm_tt_bind(struct ttm_device *bdev, struct ttm_tt *ttm, 58 static void radeon_ttm_tt_unbind(struct ttm_device *bdev, struct ttm_tt *ttm); 205 r = radeon_ttm_tt_bind(bo->bdev, bo->ttm, new_mem); in radeon_bo_move() 223 if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { in radeon_bo_move() 235 radeon_ttm_tt_unbind(bo->bdev, bo->ttm); in radeon_bo_move() 328 struct ttm_tt ttm; member 338 static int radeon_ttm_tt_pin_userptr(struct ttm_device *bdev, struct ttm_tt *ttm) in radeon_ttm_tt_pin_userptr() argument 341 struct radeon_ttm_tt *gtt = (void *)ttm; in radeon_ttm_tt_pin_userptr() 355 unsigned long end = gtt->userptr + (u64)ttm->num_pages * PAGE_SIZE; in radeon_ttm_tt_pin_userptr() 363 unsigned num_pages = ttm->num_pages - pinned; in radeon_ttm_tt_pin_userptr() [all …]
|
D | radeon_prime.c | 39 return drm_prime_pages_to_sg(obj->dev, bo->tbo.ttm->pages, in radeon_gem_prime_get_sg_table() 40 bo->tbo.ttm->num_pages); in radeon_gem_prime_get_sg_table() 117 if (radeon_ttm_tt_has_userptr(bo->rdev, bo->tbo.ttm)) in radeon_gem_prime_export()
|
D | radeon_mn.c | 57 if (!bo->tbo.ttm || !radeon_ttm_tt_is_bound(bo->tbo.bdev, bo->tbo.ttm)) in radeon_mn_invalidate()
|
/Linux-v5.15/include/drm/ttm/ |
D | ttm_tt.h | 115 int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo, 127 void ttm_tt_fini(struct ttm_tt *ttm); 136 void ttm_tt_destroy(struct ttm_device *bdev, struct ttm_tt *ttm); 143 void ttm_tt_destroy_common(struct ttm_device *bdev, struct ttm_tt *ttm); 152 int ttm_tt_swapin(struct ttm_tt *ttm); 153 int ttm_tt_swapout(struct ttm_device *bdev, struct ttm_tt *ttm, 163 int ttm_tt_populate(struct ttm_device *bdev, struct ttm_tt *ttm, struct ttm_operation_ctx *ctx); 172 void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm); 182 static inline void ttm_tt_mark_for_clear(struct ttm_tt *ttm) in ttm_tt_mark_for_clear() argument 184 ttm->page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC; in ttm_tt_mark_for_clear() [all …]
|
D | ttm_device.h | 96 struct ttm_tt *ttm, 107 struct ttm_tt *ttm); 118 void (*ttm_tt_destroy)(struct ttm_device *bdev, struct ttm_tt *ttm);
|
/Linux-v5.15/drivers/gpu/drm/nouveau/ |
D | nouveau_sgdma.c | 14 struct ttm_tt ttm; member 19 nouveau_sgdma_destroy(struct ttm_device *bdev, struct ttm_tt *ttm) in nouveau_sgdma_destroy() argument 21 struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; in nouveau_sgdma_destroy() 23 if (ttm) { in nouveau_sgdma_destroy() 24 nouveau_sgdma_unbind(bdev, ttm); in nouveau_sgdma_destroy() 25 ttm_tt_destroy_common(bdev, ttm); in nouveau_sgdma_destroy() 26 ttm_tt_fini(&nvbe->ttm); in nouveau_sgdma_destroy() 32 nouveau_sgdma_bind(struct ttm_device *bdev, struct ttm_tt *ttm, struct ttm_resource *reg) in nouveau_sgdma_bind() argument 34 struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; in nouveau_sgdma_bind() 42 ret = nouveau_mem_host(reg, &nvbe->ttm); in nouveau_sgdma_bind() [all …]
|
D | nouveau_ttm.c | 145 drm->ttm.type_host[!!kind] = typei; in nouveau_ttm_init_host() 151 drm->ttm.type_ncoh[!!kind] = typei; in nouveau_ttm_init_host() 168 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, man); in nouveau_ttm_init_vram() 172 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_VRAM, false, in nouveau_ttm_init_vram() 180 struct ttm_resource_manager *man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM); in nouveau_ttm_fini_vram() 184 ttm_resource_manager_evict_all(&drm->ttm.bdev, man); in nouveau_ttm_fini_vram() 186 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_VRAM, NULL); in nouveau_ttm_fini_vram() 189 ttm_range_man_fini(&drm->ttm.bdev, TTM_PL_VRAM); in nouveau_ttm_fini_vram() 204 return ttm_range_man_init(&drm->ttm.bdev, TTM_PL_TT, true, in nouveau_ttm_init_gtt() 214 ttm_set_driver_manager(&drm->ttm.bdev, TTM_PL_TT, man); in nouveau_ttm_init_gtt() [all …]
|
D | nouveau_bo.c | 46 static int nouveau_ttm_tt_bind(struct ttm_device *bdev, struct ttm_tt *ttm, 48 static void nouveau_ttm_tt_unbind(struct ttm_device *bdev, struct ttm_tt *ttm); 220 nvbo->bo.bdev = &drm->ttm.bdev; in nouveau_bo_alloc() 552 struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm; in nouveau_bo_sync_for_device() 588 struct ttm_tt *ttm_dma = (struct ttm_tt *)nvbo->bo.ttm; in nouveau_bo_sync_for_cpu() 625 mutex_lock(&drm->ttm.io_reserve_mutex); in nouveau_bo_add_io_reserve_lru() 626 list_move_tail(&nvbo->io_reserve_lru, &drm->ttm.io_reserve_lru); in nouveau_bo_add_io_reserve_lru() 627 mutex_unlock(&drm->ttm.io_reserve_mutex); in nouveau_bo_add_io_reserve_lru() 635 mutex_lock(&drm->ttm.io_reserve_mutex); in nouveau_bo_del_io_reserve_lru() 637 mutex_unlock(&drm->ttm.io_reserve_mutex); in nouveau_bo_del_io_reserve_lru() [all …]
|
D | nouveau_ttm.h | 8 return container_of(bd, struct nouveau_drm, ttm.bdev); in nouveau_bdev() 24 int nouveau_sgdma_bind(struct ttm_device *bdev, struct ttm_tt *ttm, struct ttm_resource *reg); 25 void nouveau_sgdma_unbind(struct ttm_device *bdev, struct ttm_tt *ttm); 26 void nouveau_sgdma_destroy(struct ttm_device *bdev, struct ttm_tt *ttm);
|
D | nouveau_mem.c | 99 type = drm->ttm.type_ncoh[!!mem->kind]; in nouveau_mem_host() 101 type = drm->ttm.type_host[0]; in nouveau_mem_host() 138 drm->ttm.type_vram, page, size, in nouveau_mem_vram() 146 drm->ttm.type_vram, page, size, in nouveau_mem_vram()
|
D | nouveau_prime.c | 34 return drm_prime_pages_to_sg(obj->dev, nvbo->bo.ttm->pages, in nouveau_gem_prime_get_sg_table() 35 nvbo->bo.ttm->num_pages); in nouveau_gem_prime_get_sg_table()
|
/Linux-v5.15/drivers/gpu/drm/i915/gem/ |
D | i915_gem_ttm.c | 48 struct ttm_tt ttm; member 107 struct ttm_tt *ttm) in i915_ttm_cache_level() argument 110 ttm->caching == ttm_cached) ? I915_CACHE_LLC : in i915_ttm_cache_level() 187 ret = ttm_tt_init(&i915_tt->ttm, bo, page_flags, in i915_ttm_tt_create() 196 return &i915_tt->ttm; in i915_ttm_tt_create() 199 static void i915_ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm) in i915_ttm_tt_unpopulate() argument 201 struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); in i915_ttm_tt_unpopulate() 210 ttm_pool_free(&bdev->pool, ttm); in i915_ttm_tt_unpopulate() 213 static void i915_ttm_tt_destroy(struct ttm_device *bdev, struct ttm_tt *ttm) in i915_ttm_tt_destroy() argument 215 struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); in i915_ttm_tt_destroy() [all …]
|
/Linux-v5.15/drivers/gpu/drm/amd/amdgpu/ |
D | amdgpu_ttm.c | 65 struct ttm_tt *ttm, 68 struct ttm_tt *ttm); 239 flags = amdgpu_ttm_tt_pte_flags(adev, bo->ttm, mem); in amdgpu_ttm_map_buffer() 248 dma_addr = &bo->ttm->dma_address[mm_cur->start >> PAGE_SHIFT]; in amdgpu_ttm_map_buffer() 472 r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem); in amdgpu_bo_move() 484 if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { in amdgpu_bo_move() 501 amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm); in amdgpu_bo_move() 638 struct ttm_tt ttm; member 660 struct ttm_tt *ttm = bo->tbo.ttm; in amdgpu_ttm_tt_get_user_pages() local 661 struct amdgpu_ttm_tt *gtt = (void *)ttm; in amdgpu_ttm_tt_get_user_pages() [all …]
|
D | amdgpu_ttm.h | 166 bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm); 173 static inline bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm) in amdgpu_ttm_tt_get_user_pages_done() argument 179 void amdgpu_ttm_tt_set_user_pages(struct ttm_tt *ttm, struct page **pages); 182 bool amdgpu_ttm_tt_has_userptr(struct ttm_tt *ttm); 183 struct mm_struct *amdgpu_ttm_tt_get_usermm(struct ttm_tt *ttm); 184 bool amdgpu_ttm_tt_affect_userptr(struct ttm_tt *ttm, unsigned long start, 186 bool amdgpu_ttm_tt_userptr_invalidated(struct ttm_tt *ttm, 188 bool amdgpu_ttm_tt_is_userptr(struct ttm_tt *ttm); 189 bool amdgpu_ttm_tt_is_readonly(struct ttm_tt *ttm); 190 uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem); [all …]
|
D | amdgpu_amdkfd_gpuvm.c | 329 if (WARN(amdgpu_ttm_tt_get_usermm(bo->tbo.ttm), in amdgpu_amdkfd_bo_validate() 475 struct ttm_tt *src_ttm = mem->bo->tbo.ttm; in kfd_mem_dmamap_userptr() 476 struct ttm_tt *ttm = bo->tbo.ttm; in kfd_mem_dmamap_userptr() local 479 ttm->sg = kmalloc(sizeof(*ttm->sg), GFP_KERNEL); in kfd_mem_dmamap_userptr() 480 if (unlikely(!ttm->sg)) in kfd_mem_dmamap_userptr() 483 if (WARN_ON(ttm->num_pages != src_ttm->num_pages)) in kfd_mem_dmamap_userptr() 487 ret = sg_alloc_table_from_pages(ttm->sg, src_ttm->pages, in kfd_mem_dmamap_userptr() 488 ttm->num_pages, 0, in kfd_mem_dmamap_userptr() 489 (u64)ttm->num_pages << PAGE_SHIFT, in kfd_mem_dmamap_userptr() 494 ret = dma_map_sgtable(adev->dev, ttm->sg, direction, 0); in kfd_mem_dmamap_userptr() [all …]
|
/Linux-v5.15/drivers/gpu/drm/vmwgfx/ |
D | vmwgfx_ttm_buffer.c | 444 container_of(bo->ttm, struct vmw_ttm_tt, dma_ttm); in vmw_bo_sg_table() 451 struct ttm_tt *ttm, struct ttm_resource *bo_mem) in vmw_ttm_bind() argument 454 container_of(ttm, struct vmw_ttm_tt, dma_ttm); in vmw_ttm_bind() 473 ttm->num_pages, vmw_be->gmr_id); in vmw_ttm_bind() 478 vmw_mob_create(ttm->num_pages); in vmw_ttm_bind() 484 &vmw_be->vsgt, ttm->num_pages, in vmw_ttm_bind() 495 struct ttm_tt *ttm) in vmw_ttm_unbind() argument 498 container_of(ttm, struct vmw_ttm_tt, dma_ttm); in vmw_ttm_unbind() 520 static void vmw_ttm_destroy(struct ttm_device *bdev, struct ttm_tt *ttm) in vmw_ttm_destroy() argument 523 container_of(ttm, struct vmw_ttm_tt, dma_ttm); in vmw_ttm_destroy() [all …]
|
D | vmwgfx_blit.c | 468 if (!ttm_tt_is_populated(dst->ttm)) { in vmw_bo_cpu_blit() 469 ret = dst->bdev->funcs->ttm_tt_populate(dst->bdev, dst->ttm, &ctx); in vmw_bo_cpu_blit() 474 if (!ttm_tt_is_populated(src->ttm)) { in vmw_bo_cpu_blit() 475 ret = src->bdev->funcs->ttm_tt_populate(src->bdev, src->ttm, &ctx); in vmw_bo_cpu_blit() 484 d.dst_pages = dst->ttm->pages; in vmw_bo_cpu_blit() 485 d.src_pages = src->ttm->pages; in vmw_bo_cpu_blit()
|
/Linux-v5.15/drivers/gpu/drm/qxl/ |
D | qxl_ttm.c | 102 static void qxl_ttm_backend_destroy(struct ttm_device *bdev, struct ttm_tt *ttm) in qxl_ttm_backend_destroy() argument 104 ttm_tt_destroy_common(bdev, ttm); in qxl_ttm_backend_destroy() 105 ttm_tt_fini(ttm); in qxl_ttm_backend_destroy() 106 kfree(ttm); in qxl_ttm_backend_destroy() 112 struct ttm_tt *ttm; in qxl_ttm_tt_create() local 114 ttm = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL); in qxl_ttm_tt_create() 115 if (ttm == NULL) in qxl_ttm_tt_create() 117 if (ttm_tt_init(ttm, bo, page_flags, ttm_cached)) { in qxl_ttm_tt_create() 118 kfree(ttm); in qxl_ttm_tt_create() 121 return ttm; in qxl_ttm_tt_create() [all …]
|
/Linux-v5.15/arch/powerpc/perf/ |
D | ppc970-pmu.c | 264 unsigned int ttm, grp; in p970_compute_mmcr() local 321 ttm = unitmap[i]; in p970_compute_mmcr() 322 ++ttmuse[(ttm >> 2) & 1]; in p970_compute_mmcr() 323 mmcr1 |= (unsigned long)(ttm & ~4) << MMCR1_TTM1SEL_SH; in p970_compute_mmcr() 335 ttm = (unitmap[unit] >> 2) & 1; in p970_compute_mmcr() 337 ttm = 2; in p970_compute_mmcr() 339 ttm = 3; in p970_compute_mmcr() 343 mmcr1 |= (unsigned long)ttm in p970_compute_mmcr()
|