Lines Matching refs:order
79 unsigned int order) in ttm_pool_alloc_page() argument
90 if (order) in ttm_pool_alloc_page()
95 p = alloc_pages(gfp_flags, order); in ttm_pool_alloc_page()
97 p->private = order; in ttm_pool_alloc_page()
105 if (order) in ttm_pool_alloc_page()
108 vaddr = dma_alloc_attrs(pool->dev, (1ULL << order) * PAGE_SIZE, in ttm_pool_alloc_page()
121 dma->vaddr = (unsigned long)vaddr | order; in ttm_pool_alloc_page()
132 unsigned int order, struct page *p) in ttm_pool_free_page() argument
143 set_pages_wb(p, 1 << order); in ttm_pool_free_page()
147 __free_pages(p, order); in ttm_pool_free_page()
151 if (order) in ttm_pool_free_page()
156 dma_free_attrs(pool->dev, (1UL << order) * PAGE_SIZE, vaddr, dma->addr, in ttm_pool_free_page()
184 static int ttm_pool_map(struct ttm_pool *pool, unsigned int order, in ttm_pool_map() argument
195 size_t size = (1ULL << order) * PAGE_SIZE; in ttm_pool_map()
202 for (i = 1 << order; i ; --i) { in ttm_pool_map()
225 unsigned int i, num_pages = 1 << pt->order; in ttm_pool_type_give()
237 atomic_long_add(1 << pt->order, &allocated_pages); in ttm_pool_type_give()
248 atomic_long_sub(1 << pt->order, &allocated_pages); in ttm_pool_type_take()
258 enum ttm_caching caching, unsigned int order) in ttm_pool_type_init() argument
262 pt->order = order; in ttm_pool_type_init()
281 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_type_fini()
287 unsigned int order) in ttm_pool_select_type() argument
290 return &pool->caching[caching].orders[order]; in ttm_pool_select_type()
296 return &global_dma32_write_combined[order]; in ttm_pool_select_type()
298 return &global_write_combined[order]; in ttm_pool_select_type()
301 return &global_dma32_uncached[order]; in ttm_pool_select_type()
303 return &global_uncached[order]; in ttm_pool_select_type()
326 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p); in ttm_pool_shrink()
327 num_pages = 1 << pt->order; in ttm_pool_shrink()
367 unsigned int i, order; in ttm_pool_alloc() local
385 for (order = min_t(unsigned int, MAX_ORDER - 1, __fls(num_pages)); in ttm_pool_alloc()
387 order = min_t(unsigned int, order, __fls(num_pages))) { in ttm_pool_alloc()
391 pt = ttm_pool_select_type(pool, tt->caching, order); in ttm_pool_alloc()
396 p = ttm_pool_alloc_page(pool, gfp_flags, order); in ttm_pool_alloc()
402 if (order) { in ttm_pool_alloc()
403 --order; in ttm_pool_alloc()
415 caching = pages + (1 << order); in ttm_pool_alloc()
419 r = ttm_pool_map(pool, order, p, &dma_addr); in ttm_pool_alloc()
424 num_pages -= 1 << order; in ttm_pool_alloc()
425 for (i = 1 << order; i; --i) in ttm_pool_alloc()
436 ttm_pool_free_page(pool, tt->caching, order, p); in ttm_pool_alloc()
441 order = ttm_pool_page_order(pool, tt->pages[i]); in ttm_pool_alloc()
442 ttm_pool_free_page(pool, tt->caching, order, tt->pages[i]); in ttm_pool_alloc()
443 i += 1 << order; in ttm_pool_alloc()
464 unsigned int order, num_pages; in ttm_pool_free() local
467 order = ttm_pool_page_order(pool, p); in ttm_pool_free()
468 num_pages = 1ULL << order; in ttm_pool_free()
472 pt = ttm_pool_select_type(pool, tt->caching, order); in ttm_pool_free()
476 ttm_pool_free_page(pool, tt->caching, order, in ttm_pool_free()