gfp.h (ac5ce2456e3e68c8ab6f03be2c2af832ec0f99b5) gfp.h (5c92a7643b14a5bc93bac6e2af5f9010e284b584)
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef __KVM_HYP_GFP_H
3#define __KVM_HYP_GFP_H
4
5#include <linux/list.h>
6
7#include <nvhe/memory.h>
8#include <nvhe/spinlock.h>

--- 37 unchanged lines hidden (view full) ---

46
47static inline void hyp_set_page_refcounted(struct hyp_page *p)
48{
49 struct hyp_pool *pool = hyp_page_to_pool(p);
50
51 hyp_spin_lock(&pool->lock);
52 if (p->refcount) {
53 hyp_spin_unlock(&pool->lock);
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef __KVM_HYP_GFP_H
3#define __KVM_HYP_GFP_H
4
5#include <linux/list.h>
6
7#include <nvhe/memory.h>
8#include <nvhe/spinlock.h>

--- 37 unchanged lines hidden (view full) ---

46
47static inline void hyp_set_page_refcounted(struct hyp_page *p)
48{
49 struct hyp_pool *pool = hyp_page_to_pool(p);
50
51 hyp_spin_lock(&pool->lock);
52 if (p->refcount) {
53 hyp_spin_unlock(&pool->lock);
54 hyp_panic();
54 BUG();
55 }
56 p->refcount = 1;
57 hyp_spin_unlock(&pool->lock);
58}
59
60/* Allocation */
61void *hyp_alloc_pages(struct hyp_pool *pool, unsigned int order);
62void hyp_get_page(void *addr);
63void hyp_put_page(void *addr);
64
65/* Used pages cannot be freed */
66int hyp_pool_init(struct hyp_pool *pool, u64 pfn, unsigned int nr_pages,
67 unsigned int reserved_pages);
68#endif /* __KVM_HYP_GFP_H */
55 }
56 p->refcount = 1;
57 hyp_spin_unlock(&pool->lock);
58}
59
60/* Allocation */
61void *hyp_alloc_pages(struct hyp_pool *pool, unsigned int order);
62void hyp_get_page(void *addr);
63void hyp_put_page(void *addr);
64
65/* Used pages cannot be freed */
66int hyp_pool_init(struct hyp_pool *pool, u64 pfn, unsigned int nr_pages,
67 unsigned int reserved_pages);
68#endif /* __KVM_HYP_GFP_H */