diff options
author | Quentin Perret <qperret@google.com> | 2022-11-10 19:02:34 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2022-11-11 16:40:54 +0000 |
commit | 0f4f7ae10ee4e6403659b2d9ddf05424eecde45b (patch) | |
tree | 198c7ce2a9083026bfbdd165bc8612498629a2a0 /arch/arm64/kvm/hyp/nvhe/page_alloc.c | |
parent | 30a0b95b1335e12efef89dd78518ed3e4a71a763 (diff) | |
download | linux-stable-0f4f7ae10ee4e6403659b2d9ddf05424eecde45b.tar.gz linux-stable-0f4f7ae10ee4e6403659b2d9ddf05424eecde45b.tar.bz2 linux-stable-0f4f7ae10ee4e6403659b2d9ddf05424eecde45b.zip |
KVM: arm64: Move hyp refcount manipulation helpers to common header file
We will soon need to manipulate 'struct hyp_page' refcounts from outside
page_alloc.c, so move the helpers to a common header file to allow them
to be reused easily.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Tested-by: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221110190259.26861-2-will@kernel.org
Diffstat (limited to 'arch/arm64/kvm/hyp/nvhe/page_alloc.c')
-rw-r--r-- | arch/arm64/kvm/hyp/nvhe/page_alloc.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c index d40f0b30b534..1ded09fc9b10 100644 --- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c +++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c @@ -144,25 +144,6 @@ static struct hyp_page *__hyp_extract_page(struct hyp_pool *pool, return p; } -static inline void hyp_page_ref_inc(struct hyp_page *p) -{ - BUG_ON(p->refcount == USHRT_MAX); - p->refcount++; -} - -static inline int hyp_page_ref_dec_and_test(struct hyp_page *p) -{ - BUG_ON(!p->refcount); - p->refcount--; - return (p->refcount == 0); -} - -static inline void hyp_set_page_refcounted(struct hyp_page *p) -{ - BUG_ON(p->refcount); - p->refcount = 1; -} - static void __hyp_put_page(struct hyp_pool *pool, struct hyp_page *p) { if (hyp_page_ref_dec_and_test(p)) |