Lines Matching refs:tbo

56 static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo)  in amdgpu_bo_destroy()  argument
58 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo); in amdgpu_bo_destroy()
62 if (bo->tbo.base.import_attach) in amdgpu_bo_destroy()
63 drm_prime_gem_destroy(&bo->tbo.base, bo->tbo.sg); in amdgpu_bo_destroy()
64 drm_gem_object_release(&bo->tbo.base); in amdgpu_bo_destroy()
69 static void amdgpu_bo_user_destroy(struct ttm_buffer_object *tbo) in amdgpu_bo_user_destroy() argument
71 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo); in amdgpu_bo_user_destroy()
76 amdgpu_bo_destroy(tbo); in amdgpu_bo_user_destroy()
79 static void amdgpu_bo_vm_destroy(struct ttm_buffer_object *tbo) in amdgpu_bo_vm_destroy() argument
81 struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev); in amdgpu_bo_vm_destroy()
82 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo); in amdgpu_bo_vm_destroy()
93 amdgpu_bo_destroy(tbo); in amdgpu_bo_vm_destroy()
126 struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev); in amdgpu_bo_placement_from_domain()
275 r = amdgpu_ttm_alloc_gart(&(*bo_ptr)->tbo); in amdgpu_bo_create_reserved()
384 ttm_resource_free(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.resource); in amdgpu_bo_create_kernel_at()
390 r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement, in amdgpu_bo_create_kernel_at()
391 &(*bo_ptr)->tbo.resource, &ctx); in amdgpu_bo_create_kernel_at()
562 drm_gem_private_object_init(adev_to_drm(adev), &bo->tbo.base, size); in amdgpu_bo_create()
580 bo->tbo.bdev = &adev->mman.bdev; in amdgpu_bo_create()
587 bo->tbo.priority = 1; in amdgpu_bo_create()
592 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, bp->type, in amdgpu_bo_create()
599 bo->tbo.resource->mem_type == TTM_PL_VRAM && in amdgpu_bo_create()
600 bo->tbo.resource->start < adev->gmc.visible_vram_size >> PAGE_SHIFT) in amdgpu_bo_create()
607 bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_create()
610 r = amdgpu_fill_buffer(bo, 0, bo->tbo.base.resv, &fence); in amdgpu_bo_create()
614 dma_resv_add_fence(bo->tbo.base.resv, fence, in amdgpu_bo_create()
632 dma_resv_unlock(bo->tbo.base.resv); in amdgpu_bo_create()
698 bo_ptr->tbo.destroy = &amdgpu_bo_vm_destroy; in amdgpu_bo_create_vm()
711 struct amdgpu_device *adev = amdgpu_ttm_adev(vmbo->bo.tbo.bdev); in amdgpu_bo_add_to_shadow_list()
734 struct amdgpu_device *adev = amdgpu_ttm_adev(shadow->tbo.bdev); in amdgpu_bo_restore_shadow()
765 r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL, in amdgpu_bo_kmap()
777 r = ttm_bo_kmap(&bo->tbo, 0, bo->tbo.resource->num_pages, &bo->kmap); in amdgpu_bo_kmap()
829 ttm_bo_get(&bo->tbo); in amdgpu_bo_ref()
841 struct ttm_buffer_object *tbo; in amdgpu_bo_unref() local
846 tbo = &((*bo)->tbo); in amdgpu_bo_unref()
847 ttm_bo_put(tbo); in amdgpu_bo_unref()
876 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_pin_restricted()
880 if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) in amdgpu_bo_pin_restricted()
891 if (bo->tbo.base.import_attach) { in amdgpu_bo_pin_restricted()
898 if (bo->tbo.pin_count) { in amdgpu_bo_pin_restricted()
899 uint32_t mem_type = bo->tbo.resource->mem_type; in amdgpu_bo_pin_restricted()
900 uint32_t mem_flags = bo->tbo.resource->placement; in amdgpu_bo_pin_restricted()
910 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin_restricted()
927 if (bo->tbo.base.import_attach) in amdgpu_bo_pin_restricted()
928 dma_buf_pin(bo->tbo.base.import_attach); in amdgpu_bo_pin_restricted()
947 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); in amdgpu_bo_pin_restricted()
953 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin_restricted()
955 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_pin_restricted()
998 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_unpin()
1000 ttm_bo_unpin(&bo->tbo); in amdgpu_bo_unpin()
1001 if (bo->tbo.pin_count) in amdgpu_bo_unpin()
1004 if (bo->tbo.base.import_attach) in amdgpu_bo_unpin()
1005 dma_buf_unpin(bo->tbo.base.import_attach); in amdgpu_bo_unpin()
1007 if (bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_unpin()
1011 } else if (bo->tbo.resource->mem_type == TTM_PL_TT) { in amdgpu_bo_unpin()
1102 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_set_tiling_flags()
1105 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_tiling_flags()
1127 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_tiling_flags()
1128 dma_resv_assert_held(bo->tbo.base.resv); in amdgpu_bo_get_tiling_flags()
1154 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_metadata()
1204 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_metadata()
1249 if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && in amdgpu_bo_move_notify()
1251 dma_buf_move_notify(abo->tbo.base.dma_buf); in amdgpu_bo_move_notify()
1270 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_get_memory()
1360 if (abo->tbo.pin_count > 0) in amdgpu_bo_fault_reserve_notify()
1399 struct dma_resv *resv = bo->tbo.base.resv; in amdgpu_bo_fence()
1453 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_sync_wait()
1455 return amdgpu_bo_sync_wait_resv(adev, bo->tbo.base.resv, in amdgpu_bo_sync_wait()
1471 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_SYSTEM); in amdgpu_bo_gpu_offset()
1472 WARN_ON_ONCE(!dma_resv_is_locked(bo->tbo.base.resv) && in amdgpu_bo_gpu_offset()
1473 !bo->tbo.pin_count && bo->tbo.type != ttm_bo_type_kernel); in amdgpu_bo_gpu_offset()
1474 WARN_ON_ONCE(bo->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET); in amdgpu_bo_gpu_offset()
1475 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && in amdgpu_bo_gpu_offset()
1490 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_gpu_offset_no_check()
1493 offset = (bo->tbo.resource->start << PAGE_SHIFT) + in amdgpu_bo_gpu_offset_no_check()
1494 amdgpu_ttm_domain_start(adev, bo->tbo.resource->mem_type); in amdgpu_bo_gpu_offset_no_check()
1548 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_print_info()
1566 pin_count = READ_ONCE(bo->tbo.pin_count); in amdgpu_bo_print_info()
1570 dma_buf = READ_ONCE(bo->tbo.base.dma_buf); in amdgpu_bo_print_info()
1571 attachment = READ_ONCE(bo->tbo.base.import_attach); in amdgpu_bo_print_info()