Lines Matching refs:tbo

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