On Tue, Jul 29, 2025 at 02:54:13PM -0600, Logan Gunthorpe wrote: > > > On 2025-07-28 17:11, Jason Gunthorpe wrote: > >> If the dma mapping for P2P memory doesn't need to create an iommu > >> mapping then that's fine. But it should be the dma-iommu layer to decide > >> that. > > > > So above, we can't use dma-iommu.c, it might not be compiled into the > > kernel but the dma_map_phys() path is still valid. > > This is an easily solved problem. I did a very rough sketch below to say > it's really not that hard. (Note it has some rough edges that could be > cleaned up and I based it off Leon's git repo which appears to not be > the same as what was posted, but the core concept is sound).
I started to prepare v2, this is why posted version is slightly different from dmabuf-vfio branch. In addition to what Jason wrote. there is an extra complexity with using state. The wrappers which operate on dma_iova_state assume that all memory, which is going to be mapped, is the same type: or p2p or not. This is not the cased for HMM/RDMA users, there you create state in advance and get mixed type of pages. Thanks