Lines Matching refs:bman

39 	struct i915_ttm_buddy_manager *bman = to_buddy_manager(man);  in i915_ttm_buddy_man_alloc()  local
41 struct drm_buddy *mm = &bman->mm; in i915_ttm_buddy_man_alloc()
71 min_page_size = bman->default_page_size; in i915_ttm_buddy_man_alloc()
85 mutex_lock(&bman->lock); in i915_ttm_buddy_man_alloc()
86 if (lpfn <= bman->visible_size && n_pages > bman->visible_avail) { in i915_ttm_buddy_man_alloc()
87 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_alloc()
101 if (lpfn <= bman->visible_size) { in i915_ttm_buddy_man_alloc()
110 if (start < bman->visible_size) { in i915_ttm_buddy_man_alloc()
115 min(end, bman->visible_size) - start; in i915_ttm_buddy_man_alloc()
121 bman->visible_avail -= bman_res->used_visible_size; in i915_ttm_buddy_man_alloc()
123 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_alloc()
130 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_alloc()
141 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_free() local
143 mutex_lock(&bman->lock); in i915_ttm_buddy_man_free()
144 drm_buddy_free_list(&bman->mm, &bman_res->blocks, 0); in i915_ttm_buddy_man_free()
145 bman->visible_avail += bman_res->used_visible_size; in i915_ttm_buddy_man_free()
146 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_free()
158 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_intersects() local
159 struct drm_buddy *mm = &bman->mm; in i915_ttm_buddy_man_intersects()
196 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_compatible() local
197 struct drm_buddy *mm = &bman->mm; in i915_ttm_buddy_man_compatible()
226 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_debug() local
229 mutex_lock(&bman->lock); in i915_ttm_buddy_man_debug()
231 bman->default_page_size >> 10); in i915_ttm_buddy_man_debug()
233 (u64)bman->visible_avail << PAGE_SHIFT >> 20); in i915_ttm_buddy_man_debug()
235 (u64)bman->visible_size << PAGE_SHIFT >> 20); in i915_ttm_buddy_man_debug()
237 (u64)bman->visible_reserved << PAGE_SHIFT >> 20); in i915_ttm_buddy_man_debug()
239 drm_buddy_print(&bman->mm, printer); in i915_ttm_buddy_man_debug()
242 list_for_each_entry(block, &bman->reserved, link) in i915_ttm_buddy_man_debug()
243 drm_buddy_block_print(&bman->mm, block, printer); in i915_ttm_buddy_man_debug()
244 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_debug()
289 struct i915_ttm_buddy_manager *bman; in i915_ttm_buddy_man_init() local
292 bman = kzalloc(sizeof(*bman), GFP_KERNEL); in i915_ttm_buddy_man_init()
293 if (!bman) in i915_ttm_buddy_man_init()
296 err = drm_buddy_init(&bman->mm, size, chunk_size); in i915_ttm_buddy_man_init()
300 mutex_init(&bman->lock); in i915_ttm_buddy_man_init()
301 INIT_LIST_HEAD(&bman->reserved); in i915_ttm_buddy_man_init()
303 bman->default_page_size = default_page_size; in i915_ttm_buddy_man_init()
304 bman->visible_size = visible_size >> PAGE_SHIFT; in i915_ttm_buddy_man_init()
305 bman->visible_avail = bman->visible_size; in i915_ttm_buddy_man_init()
307 man = &bman->manager; in i915_ttm_buddy_man_init()
310 ttm_resource_manager_init(man, bdev, bman->mm.size >> PAGE_SHIFT); in i915_ttm_buddy_man_init()
318 kfree(bman); in i915_ttm_buddy_man_init()
335 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_fini() local
336 struct drm_buddy *mm = &bman->mm; in i915_ttm_buddy_man_fini()
347 mutex_lock(&bman->lock); in i915_ttm_buddy_man_fini()
348 drm_buddy_free_list(mm, &bman->reserved, 0); in i915_ttm_buddy_man_fini()
350 bman->visible_avail += bman->visible_reserved; in i915_ttm_buddy_man_fini()
351 WARN_ON_ONCE(bman->visible_avail != bman->visible_size); in i915_ttm_buddy_man_fini()
352 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_fini()
355 kfree(bman); in i915_ttm_buddy_man_fini()
373 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_reserve() local
374 struct drm_buddy *mm = &bman->mm; in i915_ttm_buddy_man_reserve()
381 mutex_lock(&bman->lock); in i915_ttm_buddy_man_reserve()
385 &bman->reserved, in i915_ttm_buddy_man_reserve()
388 if (fpfn < bman->visible_size) { in i915_ttm_buddy_man_reserve()
390 unsigned long visible = min(lpfn, bman->visible_size) - fpfn; in i915_ttm_buddy_man_reserve()
392 bman->visible_reserved += visible; in i915_ttm_buddy_man_reserve()
393 bman->visible_avail -= visible; in i915_ttm_buddy_man_reserve()
395 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_reserve()
407 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_visible_size() local
409 return bman->visible_size; in i915_ttm_buddy_man_visible_size()
424 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_avail() local
426 mutex_lock(&bman->lock); in i915_ttm_buddy_man_avail()
427 *avail = bman->mm.avail >> PAGE_SHIFT; in i915_ttm_buddy_man_avail()
428 *visible_avail = bman->visible_avail; in i915_ttm_buddy_man_avail()
429 mutex_unlock(&bman->lock); in i915_ttm_buddy_man_avail()
436 struct i915_ttm_buddy_manager *bman = to_buddy_manager(man); in i915_ttm_buddy_man_force_visible_size() local
438 bman->visible_size = size; in i915_ttm_buddy_man_force_visible_size()