KVM: arm64: Add support for 32-bit refcounts to pKVM Use the handy new __GEN_REFCOUNT() macro to generate a 32-bit refcount. Signed-off-by: Will Deacon <will@kernel.org>
diff --git a/arch/arm64/kvm/hyp/include/nvhe/refcount.h b/arch/arm64/kvm/hyp/include/nvhe/refcount.h index b545cc7..844188a 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/refcount.h +++ b/arch/arm64/kvm/hyp/include/nvhe/refcount.h
@@ -45,6 +45,7 @@ static inline s##sz __lse_refcount_fetch_add_##sz(u##sz *refcount, \ } __GEN_REFCOUNT(16, h, w) +__GEN_REFCOUNT(32, , w) static inline u64 __hyp_refcount_fetch_add(void *refcount, const size_t size, const s64 addend) @@ -55,6 +56,9 @@ static inline u64 __hyp_refcount_fetch_add(void *refcount, const size_t size, case 2: new = __lse_ll_sc_body(refcount_fetch_add_16, refcount, addend); break; + case 4: + new = __lse_ll_sc_body(refcount_fetch_add_32, refcount, addend); + break; default: BUILD_BUG_ON_MSG(1, "Unsupported refcount size"); unreachable();