Re: [PATCH] KVM: arm64: Use consistent type for pool size
From: Will Deacon
Date: Sun Jul 26 2026 - 10:01:22 EST
On Wed, Jul 15, 2026 at 03:01:25PM +0000, Mostafa Saleh wrote:
> All the pool sizes in the hypervisor are "unsigned long" but when
> they get passed to hyp_early_alloc_contig() or hyp_pool_init() they get
> truncated to 32-bits.
>
> That is not a big problem at the moment as to overflow this we need
> 4G bytes of carveout (2 TB of host or guest system memory).
>
> However when new users are added (as IOMMU) it is hard to reason
> about the carveout size anymore.
>
> Signed-off-by: Mostafa Saleh <smostafa@xxxxxxxxxx>
> ---
> For example in the SMMUv3 to avoid this overflow, I add a cap
> for the pools size to UINT_MAX to work around this:
> https://lore.kernel.org/linux-iommu/20260715115906.2664882-9-smostafa@xxxxxxxxxx/
> ---
> arch/arm64/kvm/hyp/include/nvhe/early_alloc.h | 2 +-
> arch/arm64/kvm/hyp/include/nvhe/gfp.h | 4 ++--
> arch/arm64/kvm/hyp/nvhe/early_alloc.c | 2 +-
> arch/arm64/kvm/hyp/nvhe/page_alloc.c | 6 +++---
> 4 files changed, 7 insertions(+), 7 deletions(-)
Acked-by: Will Deacon <will@xxxxxxxxxx>
Will