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

Jason Gunthorpe jgg at ziepe.ca
Fri May 15 06:36:01 PDT 2026


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 <smostafa at google.com>
> ---
>  drivers/iommu/io-pgtable-arm.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>

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



More information about the linux-arm-kernel mailing list