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()
425 WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); in amdgpu_bo_free_kernel()
565 drm_gem_private_object_init(adev_to_drm(adev), &bo->tbo.base, size); in amdgpu_bo_create()
583 bo->tbo.bdev = &adev->mman.bdev; in amdgpu_bo_create()
590 bo->tbo.priority = 1; in amdgpu_bo_create()
595 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, bp->type, in amdgpu_bo_create()
602 bo->tbo.resource->mem_type == TTM_PL_VRAM && in amdgpu_bo_create()
603 bo->tbo.resource->start < adev->gmc.visible_vram_size >> PAGE_SHIFT) in amdgpu_bo_create()
610 bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_create()
613 r = amdgpu_fill_buffer(bo, 0, bo->tbo.base.resv, &fence); in amdgpu_bo_create()
617 dma_resv_add_fence(bo->tbo.base.resv, fence, in amdgpu_bo_create()
635 dma_resv_unlock(bo->tbo.base.resv); in amdgpu_bo_create()
701 bo_ptr->tbo.destroy = &amdgpu_bo_vm_destroy; in amdgpu_bo_create_vm()
714 struct amdgpu_device *adev = amdgpu_ttm_adev(vmbo->bo.tbo.bdev); in amdgpu_bo_add_to_shadow_list()
737 struct amdgpu_device *adev = amdgpu_ttm_adev(shadow->tbo.bdev); in amdgpu_bo_restore_shadow()
768 r = dma_resv_wait_timeout(bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL, in amdgpu_bo_kmap()
780 r = ttm_bo_kmap(&bo->tbo, 0, PFN_UP(bo->tbo.base.size), &bo->kmap); in amdgpu_bo_kmap()
832 ttm_bo_get(&bo->tbo); in amdgpu_bo_ref()
844 struct ttm_buffer_object *tbo; in amdgpu_bo_unref() local
849 tbo = &((*bo)->tbo); in amdgpu_bo_unref()
850 ttm_bo_put(tbo); in amdgpu_bo_unref()
879 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_pin_restricted()
883 if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) in amdgpu_bo_pin_restricted()
894 if (bo->tbo.base.import_attach) { in amdgpu_bo_pin_restricted()
901 if (bo->tbo.pin_count) { in amdgpu_bo_pin_restricted()
902 uint32_t mem_type = bo->tbo.resource->mem_type; in amdgpu_bo_pin_restricted()
903 uint32_t mem_flags = bo->tbo.resource->placement; in amdgpu_bo_pin_restricted()
913 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin_restricted()
930 if (bo->tbo.base.import_attach) in amdgpu_bo_pin_restricted()
931 dma_buf_pin(bo->tbo.base.import_attach); in amdgpu_bo_pin_restricted()
950 r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); in amdgpu_bo_pin_restricted()
956 ttm_bo_pin(&bo->tbo); in amdgpu_bo_pin_restricted()
958 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_pin_restricted()
1001 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_unpin()
1003 ttm_bo_unpin(&bo->tbo); in amdgpu_bo_unpin()
1004 if (bo->tbo.pin_count) in amdgpu_bo_unpin()
1007 if (bo->tbo.base.import_attach) in amdgpu_bo_unpin()
1008 dma_buf_unpin(bo->tbo.base.import_attach); in amdgpu_bo_unpin()
1010 if (bo->tbo.resource->mem_type == TTM_PL_VRAM) { in amdgpu_bo_unpin()
1014 } else if (bo->tbo.resource->mem_type == TTM_PL_TT) { in amdgpu_bo_unpin()
1105 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_set_tiling_flags()
1108 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_tiling_flags()
1130 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_tiling_flags()
1131 dma_resv_assert_held(bo->tbo.base.resv); in amdgpu_bo_get_tiling_flags()
1157 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_set_metadata()
1207 BUG_ON(bo->tbo.type == ttm_bo_type_kernel); in amdgpu_bo_get_metadata()
1252 if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && in amdgpu_bo_move_notify()
1254 dma_buf_move_notify(abo->tbo.base.dma_buf); in amdgpu_bo_move_notify()
1273 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_get_memory()
1363 if (abo->tbo.pin_count > 0) in amdgpu_bo_fault_reserve_notify()
1402 struct dma_resv *resv = bo->tbo.base.resv; in amdgpu_bo_fence()
1456 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_sync_wait()
1458 return amdgpu_bo_sync_wait_resv(adev, bo->tbo.base.resv, in amdgpu_bo_sync_wait()
1474 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_SYSTEM); in amdgpu_bo_gpu_offset()
1475 WARN_ON_ONCE(!dma_resv_is_locked(bo->tbo.base.resv) && in amdgpu_bo_gpu_offset()
1476 !bo->tbo.pin_count && bo->tbo.type != ttm_bo_type_kernel); in amdgpu_bo_gpu_offset()
1477 WARN_ON_ONCE(bo->tbo.resource->start == AMDGPU_BO_INVALID_OFFSET); in amdgpu_bo_gpu_offset()
1478 WARN_ON_ONCE(bo->tbo.resource->mem_type == TTM_PL_VRAM && in amdgpu_bo_gpu_offset()
1493 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); in amdgpu_bo_gpu_offset_no_check()
1496 offset = (bo->tbo.resource->start << PAGE_SHIFT) + in amdgpu_bo_gpu_offset_no_check()
1497 amdgpu_ttm_domain_start(adev, bo->tbo.resource->mem_type); in amdgpu_bo_gpu_offset_no_check()
1551 domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type); in amdgpu_bo_print_info()
1569 pin_count = READ_ONCE(bo->tbo.pin_count); in amdgpu_bo_print_info()
1573 dma_buf = READ_ONCE(bo->tbo.base.dma_buf); in amdgpu_bo_print_info()
1574 attachment = READ_ONCE(bo->tbo.base.import_attach); in amdgpu_bo_print_info()