Lines Matching refs:tbo

59 static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)  in amdgpu_bo_destroy()  argument
61 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo); in amdgpu_bo_destroy()
65 if (bo->tbo.base.import_attach) in amdgpu_bo_destroy()
66 drm_prime_gem_destroy(&bo->tbo.base, bo->tbo.sg); in amdgpu_bo_destroy()
67 drm_gem_object_release(&bo->tbo.base); in amdgpu_bo_destroy()
72 static void amdgpu_bo_user_destroy(struct ttm_buffer_object *tbo) in amdgpu_bo_user_destroy() argument
74 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo); in amdgpu_bo_user_destroy()
79 amdgpu_bo_destroy(tbo); in amdgpu_bo_user_destroy()
111 struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev); in amdgpu_bo_placement_from_domain()
140 if (abo->tbo.type == ttm_bo_type_kernel && in amdgpu_bo_placement_from_domain()
166 if (abo->tbo.resource && !(adev->flags & AMD_IS_APU) && in amdgpu_bo_placement_from_domain()
284 r = amdgpu_ttm_alloc_gart(&(*bo_ptr)->tbo); in amdgpu_bo_create_reserved()
402 r = amdgpu_ttm_alloc_gart(&(*bo)->tbo); in amdgpu_bo_create_isp_user()
466 ttm_resource_free(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.resource); in amdgpu_bo_create_kernel_at()
472 r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement, in amdgpu_bo_create_kernel_at()
473 &(*bo_ptr)->tbo.resource, &ctx); in amdgpu_bo_create_kernel_at()
510 WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); in amdgpu_bo_free_kernel()
669 drm_gem_private_object_init(adev_to_drm(adev), &bo->tbo.base, size); in amdgpu_bo_create()
670 bo->tbo.base.funcs = &amdgpu_gem_object_funcs; in amdgpu_bo_create()
692 bo->tbo.bdev = &adev->mman.bdev; in amdgpu_bo_create()
699 bo->tbo.priority = 2; in amdgpu_bo_create()
701 bo->tbo.priority = 1; in amdgpu_bo_create()
706 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, bp->type, in amdgpu_bo_create()
713 amdgpu_res_cpu_visible(adev, bo->tbo.resource)) in amdgpu_bo_create()
720 bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_create()
723 r = amdgpu_ttm_clear_buffer(bo, bo->tbo.base.resv, &fence); in amdgpu_bo_create()
727 dma_resv_add_fence(bo->tbo.base.resv, fence, in amdgpu_bo_create()
745 dma_resv_unlock(bo->tbo.base.resv); in amdgpu_bo_create()
829 r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL, in amdgpu_bo_kmap()
841 r = ttm_bo_kmap(&bo->tbo, 0, PFN_UP(bo->tbo.base.size), &bo->kmap); in amdgpu_bo_kmap()
893 drm_gem_object_get(&bo->tbo.base); in amdgpu_bo_ref()
908 drm_gem_object_put(&(*bo)->tbo.base); in amdgpu_bo_unref()
930 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_pin()
934 if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) in amdgpu_bo_pin()
942 if (bo->tbo.base.import_attach) { in amdgpu_bo_pin()
949 if (bo->tbo.pin_count) { in amdgpu_bo_pin()
950 uint32_t mem_type = bo->tbo.resource->mem_type; in amdgpu_bo_pin()
951 uint32_t mem_flags = bo->tbo.resource->placement; in amdgpu_bo_pin()
961 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin()
970 if (bo->tbo.base.import_attach) in amdgpu_bo_pin()
971 dma_buf_pin(bo->tbo.base.import_attach); in amdgpu_bo_pin()
983 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); in amdgpu_bo_pin()
989 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin()
991 if (bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_pin()
995 } else if (bo->tbo.resource->mem_type == TTM_PL_TT) { in amdgpu_bo_pin()
1015 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_unpin()
1017 ttm_bo_unpin(&bo->tbo); in amdgpu_bo_unpin()
1018 if (bo->tbo.pin_count) in amdgpu_bo_unpin()
1021 if (bo->tbo.base.import_attach) in amdgpu_bo_unpin()
1022 dma_buf_unpin(bo->tbo.base.import_attach); in amdgpu_bo_unpin()
1024 if (bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_unpin()
1028 } else if (bo->tbo.resource->mem_type == TTM_PL_TT) { in amdgpu_bo_unpin()
1119 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_set_tiling_flags()
1122 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_tiling_flags()
1144 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_tiling_flags()
1145 dma_resv_assert_held(bo->tbo.base.resv); in amdgpu_bo_get_tiling_flags()
1171 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_metadata()
1221 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_metadata()
1265 if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && in amdgpu_bo_move_notify()
1267 dma_buf_move_notify(abo->tbo.base.dma_buf); in amdgpu_bo_move_notify()
1355 if (abo->tbo.pin_count > 0) in amdgpu_bo_fault_reserve_notify()
1392 struct dma_resv *resv = bo->tbo.base.resv; in amdgpu_bo_fence()
1446 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_sync_wait()
1448 return amdgpu_bo_sync_wait_resv(adev, bo->tbo.base.resv, in amdgpu_bo_sync_wait()
1464 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_SYSTEM); in amdgpu_bo_gpu_offset()
1465 WARN_ON_ONCE(!dma_resv_is_locked(bo->tbo.base.resv) && in amdgpu_bo_gpu_offset()
1466 !bo->tbo.pin_count && bo->tbo.type != ttm_bo_type_kernel); in amdgpu_bo_gpu_offset()
1467 WARN_ON_ONCE(bo->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET); in amdgpu_bo_gpu_offset()
1468 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && in amdgpu_bo_gpu_offset()
1483 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_gpu_offset_no_check()
1486 if (bo->tbo.resource->mem_type == TTM_PL_TT) in amdgpu_bo_gpu_offset_no_check()
1487 offset = amdgpu_gmc_agp_addr(&bo->tbo); in amdgpu_bo_gpu_offset_no_check()
1490 offset = (bo->tbo.resource->start << PAGE_SHIFT) + in amdgpu_bo_gpu_offset_no_check()
1491 amdgpu_ttm_domain_start(adev, bo->tbo.resource->mem_type); in amdgpu_bo_gpu_offset_no_check()
1577 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_print_info()
1584 if (dma_resv_trylock(bo->tbo.base.resv)) { in amdgpu_bo_print_info()
1585 if (!bo->tbo.resource) { in amdgpu_bo_print_info()
1588 switch (bo->tbo.resource->mem_type) { in amdgpu_bo_print_info()
1590 if (amdgpu_res_cpu_visible(adev, bo->tbo.resource)) in amdgpu_bo_print_info()
1619 dma_resv_unlock(bo->tbo.base.resv); in amdgpu_bo_print_info()
1628 pin_count = READ_ONCE(bo->tbo.pin_count); in amdgpu_bo_print_info()
1632 dma_buf = READ_ONCE(bo->tbo.base.dma_buf); in amdgpu_bo_print_info()
1633 attachment = READ_ONCE(bo->tbo.base.import_attach); in amdgpu_bo_print_info()