[PATCH v6 06/25] iommu/io-pgtable-arm: Rework to use the iommu-pages API

Jason Gunthorpe jgg at ziepe.ca
Sat May 9 16:21:55 PDT 2026


On Mon, May 04, 2026 at 12:19:37PM +0000, Mostafa Saleh wrote:
> > So.. I suggest you update it to use the iommu_pages API, #ifdef out
> > the allocator so the pkvm pkvm doesn't need to deal with it. Then
> > compile a special iommu-pages for the pkvm side presenting the same
> > API.
> 
> I see, we still need to leave the DMA-API calls for the custom config,
> as I am not sure if it can use pages not backed by the vmemmap, I
> pushed that into a separate function so it’s easily compiled out.

Yeah..

> Without this patch, now it looks like:

Seems reasonable, and then i'd probably just put something like
   #define dma_map(...)
   #define dma_umap(...)

To effectively take it out of the pkvm build

Then have a pkvm compile of iommu-pages to provide the functions in a
pkvm compatible way. I guess you can't actually fully do this, but
can do enough to support this file at least.

> > You should have a pkvm shim header that provides
> > kmalloc/kfree/virt_to_phys in the normal way and just #include that in
> > io-pgtable when doing a pkvm build instead of hacking up all the code.
> 
> Ok, I can do that in another change, but I believe it's better to
> change the usage in this file to arm_lpae_*(virt_to_phys...) so it's
> clear which parts are intended for that.

IDK, why? virt_to_phys() is part of the iommu-pages API, I'd just
leave it.. If you want to narrow it then #define it for pkvm when
compiling this file..

Jason



More information about the linux-arm-kernel mailing list