Lines Matching refs:bdev
81 man = ttm_manager_type(bo->bdev, mem_type); in ttm_bo_mem_space_debug()
115 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_add_mem_to_lru() local
124 man = ttm_manager_type(bdev, mem->mem_type); in ttm_bo_add_mem_to_lru()
136 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_del_from_lru() local
148 if (notify && bdev->driver->del_from_lru_notify) in ttm_bo_del_from_lru()
149 bdev->driver->del_from_lru_notify(bo); in ttm_bo_del_from_lru()
199 man = ttm_manager_type(pos->first->bdev, TTM_PL_TT); in ttm_bo_bulk_move_lru_tail()
214 man = ttm_manager_type(pos->first->bdev, TTM_PL_VRAM); in ttm_bo_bulk_move_lru_tail()
239 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_handle_move_mem() local
240 struct ttm_resource_manager *old_man = ttm_manager_type(bdev, bo->mem.mem_type); in ttm_bo_handle_move_mem()
241 struct ttm_resource_manager *new_man = ttm_manager_type(bdev, mem->mem_type); in ttm_bo_handle_move_mem()
263 ret = ttm_tt_populate(bdev, bo->ttm, ctx); in ttm_bo_handle_move_mem()
273 if (bdev->driver->move_notify) in ttm_bo_handle_move_mem()
274 bdev->driver->move_notify(bo, evict, mem); in ttm_bo_handle_move_mem()
280 if (bdev->driver->move_notify) in ttm_bo_handle_move_mem()
281 bdev->driver->move_notify(bo, evict, mem); in ttm_bo_handle_move_mem()
285 else if (bdev->driver->move) in ttm_bo_handle_move_mem()
286 ret = bdev->driver->move(bo, evict, ctx, mem); in ttm_bo_handle_move_mem()
291 if (bdev->driver->move_notify) { in ttm_bo_handle_move_mem()
293 bdev->driver->move_notify(bo, false, mem); in ttm_bo_handle_move_mem()
305 new_man = ttm_manager_type(bdev, bo->mem.mem_type); in ttm_bo_handle_move_mem()
322 if (bo->bdev->driver->move_notify) in ttm_bo_cleanup_memtype_use()
323 bo->bdev->driver->move_notify(bo, false, NULL); in ttm_bo_cleanup_memtype_use()
458 static bool ttm_bo_delayed_delete(struct ttm_bo_device *bdev, bool remove_all) in ttm_bo_delayed_delete() argument
467 while (!list_empty(&bdev->ddestroy)) { in ttm_bo_delayed_delete()
470 bo = list_first_entry(&bdev->ddestroy, struct ttm_buffer_object, in ttm_bo_delayed_delete()
492 list_splice_tail(&removed, &bdev->ddestroy); in ttm_bo_delayed_delete()
493 empty = list_empty(&bdev->ddestroy); in ttm_bo_delayed_delete()
501 struct ttm_bo_device *bdev = in ttm_bo_delayed_workqueue() local
504 if (!ttm_bo_delayed_delete(bdev, false)) in ttm_bo_delayed_workqueue()
505 schedule_delayed_work(&bdev->wq, in ttm_bo_delayed_workqueue()
513 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_release() local
527 if (bo->bdev->driver->release_notify) in ttm_bo_release()
528 bo->bdev->driver->release_notify(bo); in ttm_bo_release()
530 drm_vma_offset_remove(bdev->vma_manager, &bo->base.vma_node); in ttm_bo_release()
531 ttm_mem_io_free(bdev, &bo->mem); in ttm_bo_release()
554 list_add_tail(&bo->ddestroy, &bdev->ddestroy); in ttm_bo_release()
557 schedule_delayed_work(&bdev->wq, in ttm_bo_release()
584 int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev) in ttm_bo_lock_delayed_workqueue() argument
586 return cancel_delayed_work_sync(&bdev->wq); in ttm_bo_lock_delayed_workqueue()
590 void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched) in ttm_bo_unlock_delayed_workqueue() argument
593 schedule_delayed_work(&bdev->wq, in ttm_bo_unlock_delayed_workqueue()
601 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_evict() local
610 bdev->driver->evict_flags(bo, &placement); in ttm_bo_evict()
725 int ttm_mem_evict_first(struct ttm_bo_device *bdev, in ttm_mem_evict_first() argument
749 if (place && !bdev->driver->eviction_valuable(bo, in ttm_mem_evict_first()
842 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_mem_force_space() local
843 struct ttm_resource_manager *man = ttm_manager_type(bdev, mem->mem_type); in ttm_bo_mem_force_space()
854 ret = ttm_mem_evict_first(bdev, man, place, ctx, in ttm_bo_mem_force_space()
902 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_mem_placement() local
906 man = ttm_manager_type(bdev, place->mem_type); in ttm_bo_mem_placement()
938 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_mem_space() local
961 man = ttm_manager_type(bdev, mem->mem_type); in ttm_bo_mem_space()
1119 int ttm_bo_init_reserved(struct ttm_bo_device *bdev, in ttm_bo_init_reserved() argument
1162 bo->bdev = bdev; in ttm_bo_init_reserved()
1198 ret = drm_vma_offset_add(bdev->vma_manager, &bo->base.vma_node, in ttm_bo_init_reserved()
1226 int ttm_bo_init(struct ttm_bo_device *bdev, in ttm_bo_init() argument
1241 ret = ttm_bo_init_reserved(bdev, bo, size, type, placement, in ttm_bo_init()
1254 static size_t ttm_bo_acc_size(struct ttm_bo_device *bdev, in ttm_bo_acc_size() argument
1267 size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, in ttm_bo_dma_acc_size() argument
1281 int ttm_bo_create(struct ttm_bo_device *bdev, in ttm_bo_create() argument
1297 acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); in ttm_bo_create()
1298 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, in ttm_bo_create()
1308 int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type) in ttm_bo_evict_mm() argument
1310 struct ttm_resource_manager *man = ttm_manager_type(bdev, mem_type); in ttm_bo_evict_mm()
1322 return ttm_resource_manager_force_list_clean(bdev, man); in ttm_bo_evict_mm()
1386 int ttm_bo_device_release(struct ttm_bo_device *bdev) in ttm_bo_device_release() argument
1393 man = ttm_manager_type(bdev, TTM_PL_SYSTEM); in ttm_bo_device_release()
1395 ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); in ttm_bo_device_release()
1398 list_del(&bdev->device_list); in ttm_bo_device_release()
1401 cancel_delayed_work_sync(&bdev->wq); in ttm_bo_device_release()
1403 if (ttm_bo_delayed_delete(bdev, true)) in ttm_bo_device_release()
1419 static void ttm_bo_init_sysman(struct ttm_bo_device *bdev) in ttm_bo_init_sysman() argument
1421 struct ttm_resource_manager *man = &bdev->sysman; in ttm_bo_init_sysman()
1430 ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, man); in ttm_bo_init_sysman()
1434 int ttm_bo_device_init(struct ttm_bo_device *bdev, in ttm_bo_device_init() argument
1450 bdev->driver = driver; in ttm_bo_device_init()
1452 ttm_bo_init_sysman(bdev); in ttm_bo_device_init()
1454 bdev->vma_manager = vma_manager; in ttm_bo_device_init()
1455 INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); in ttm_bo_device_init()
1456 INIT_LIST_HEAD(&bdev->ddestroy); in ttm_bo_device_init()
1457 bdev->dev_mapping = mapping; in ttm_bo_device_init()
1458 bdev->need_dma32 = need_dma32; in ttm_bo_device_init()
1460 list_add_tail(&bdev->device_list, &glob->device_list); in ttm_bo_device_init()
1473 struct ttm_bo_device *bdev = bo->bdev; in ttm_bo_unmap_virtual() local
1475 drm_vma_node_unmap(&bo->base.vma_node, bdev->dev_mapping); in ttm_bo_unmap_virtual()
1476 ttm_mem_io_free(bdev, &bo->mem); in ttm_bo_unmap_virtual()
1584 if (bo->bdev->driver->swap_notify) in ttm_bo_swapout()
1585 bo->bdev->driver->swap_notify(bo); in ttm_bo_swapout()
1587 ret = ttm_tt_swapout(bo->bdev, bo->ttm, bo->persistent_swap_storage); in ttm_bo_swapout()
1618 ttm_tt_destroy(bo->bdev, bo->ttm); in ttm_bo_tt_destroy()
1624 return bo->bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem); in ttm_bo_tt_bind()
1629 bo->bdev->driver->ttm_tt_unbind(bo->bdev, bo->ttm); in ttm_bo_tt_unbind()