Subject: Re: [PATCH 1/3] iommu/io-pgtable-arm: Use consistent sizes for page allocation and freeing

From: Jason Gunthorpe <[email-masked]>
Date: Fri, 15 May 2026 10:36:01 -0300

On Wed, May 13, 2026 at 09:52:01PM +0000, Mostafa Saleh wrote:
> At the moment we use alloc_size to allocate memory but then there
> is a logical error where we just size in the error and free path,
> which might be smaller.
> Also we size to do DMA-API operations, which is OK, but confusing.
> 
> Instead of this error-prone handling, just set size to alloc_size
> and use it everywhere.
> 
> Signed-off-by: Mostafa Saleh <[email-masked]>
> ---
>  drivers/iommu/io-pgtable-arm.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Jason Gunthorpe <[email-masked]>

This is similar to how iommupt works, pt_top_memsize_lg2() rounds up
the top table size to the alignment minimum and we just dma map
flush/etc the larger size everwhere.

Jason