Lines Matching refs:pool

33 static struct hyp_page *__find_buddy_nocheck(struct hyp_pool *pool,  in __find_buddy_nocheck()  argument
45 if (addr < pool->range_start || addr >= pool->range_end) in __find_buddy_nocheck()
52 static struct hyp_page *__find_buddy_avail(struct hyp_pool *pool, in __find_buddy_avail() argument
56 struct hyp_page *buddy = __find_buddy_nocheck(pool, p, order); in __find_buddy_avail()
93 static void __hyp_attach_page(struct hyp_pool *pool, in __hyp_attach_page() argument
108 for (; (order + 1) < pool->max_order; order++) { in __hyp_attach_page()
109 buddy = __find_buddy_avail(pool, p, order); in __hyp_attach_page()
121 page_add_to_list(p, &pool->free_area[order]); in __hyp_attach_page()
124 static struct hyp_page *__hyp_extract_page(struct hyp_pool *pool, in __hyp_extract_page() argument
139 buddy = __find_buddy_nocheck(pool, p, p->order); in __hyp_extract_page()
141 page_add_to_list(buddy, &pool->free_area[buddy->order]); in __hyp_extract_page()
166 static void __hyp_put_page(struct hyp_pool *pool, struct hyp_page *p) in __hyp_put_page() argument
169 __hyp_attach_page(pool, p); in __hyp_put_page()
179 void hyp_put_page(struct hyp_pool *pool, void *addr) in hyp_put_page() argument
183 hyp_spin_lock(&pool->lock); in hyp_put_page()
184 __hyp_put_page(pool, p); in hyp_put_page()
185 hyp_spin_unlock(&pool->lock); in hyp_put_page()
188 void hyp_get_page(struct hyp_pool *pool, void *addr) in hyp_get_page() argument
192 hyp_spin_lock(&pool->lock); in hyp_get_page()
194 hyp_spin_unlock(&pool->lock); in hyp_get_page()
211 void *hyp_alloc_pages(struct hyp_pool *pool, unsigned short order) in hyp_alloc_pages() argument
216 hyp_spin_lock(&pool->lock); in hyp_alloc_pages()
219 while (i < pool->max_order && list_empty(&pool->free_area[i])) in hyp_alloc_pages()
221 if (i >= pool->max_order) { in hyp_alloc_pages()
222 hyp_spin_unlock(&pool->lock); in hyp_alloc_pages()
227 p = node_to_page(pool->free_area[i].next); in hyp_alloc_pages()
228 p = __hyp_extract_page(pool, p, order); in hyp_alloc_pages()
231 hyp_spin_unlock(&pool->lock); in hyp_alloc_pages()
236 int hyp_pool_init(struct hyp_pool *pool, u64 pfn, unsigned int nr_pages, in hyp_pool_init() argument
243 hyp_spin_lock_init(&pool->lock); in hyp_pool_init()
244 pool->max_order = min(MAX_ORDER, get_order((nr_pages + 1) << PAGE_SHIFT)); in hyp_pool_init()
245 for (i = 0; i < pool->max_order; i++) in hyp_pool_init()
246 INIT_LIST_HEAD(&pool->free_area[i]); in hyp_pool_init()
247 pool->range_start = phys; in hyp_pool_init()
248 pool->range_end = phys + (nr_pages << PAGE_SHIFT); in hyp_pool_init()
259 __hyp_put_page(pool, &p[i]); in hyp_pool_init()