Subject: Re: [PATCH 2/3] iommu/io-pgtable-arm: Rework to use the iommu-pages API

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

On Wed, May 13, 2026 at 09:52:02PM +0000, Mostafa Saleh wrote:
> Update the io-pgtable-arm allocator to use the iommu-pages API.
> 
> Replace the DMA API usage from __arm_lpae_alloc_pages() with
> iommu_pages_start_incoherent() and from __arm_lpae_free_pages() with
> iommu_pages_free_incoherent().
> 
> Since the iommu-pages API relies on metadata stored in the struct page
> during iommu_alloc_pages_node_sz(), it cannot be used safely with memory
> allocated via the custom cfg->alloc (which may not be backed by pages).
> So, isolate that logic and keep it as it.
> 
> Suggested-by: Jason Gunthorpe <[email-masked]>
> Signed-off-by: Mostafa Saleh <[email-masked]>
> ---
>  drivers/iommu/io-pgtable-arm.c | 79 ++++++++++++++++++++++++----------
>  1 file changed, 56 insertions(+), 23 deletions(-)

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

I feel the setup for incoherent walk for panthor is kind of sketchy,
if you select incoherent walk and pass in a random GPU driver struct
device there are alot of assumptions suddenly to know the dma API is
doing the right thing..

Jason