On Thu, Oct 16, 2025 at 11:31:53PM -0700, Christoph Hellwig wrote:
Nacked-by: Christoph Hellwig hch@lst.de
As explained to you multiple times, pci_p2pdma_map_type is a low-level helper that absolutely MUST be wrapper in proper accessors.
You never responded to the discussion:
https://lore.kernel.org/all/20250727190252.GF7551@nvidia.com/
What is the plan here? Is the new DMA API unusable by modules? That seems a little challenging.
It is dangerous when used incorrectly and requires too much boiler plate. There is no way this can be directly exported, and you really need to stop resending this.
Yeah, I don't like the boilerplate at all either.
It looks like there is a simple enough solution here. I wanted to tackle this after, but maybe it is small enough to do it now.
dmabuf should gain some helpers like BIO has to manage its map/unmap flows, so lets put a start of some helpers in drivers/dma/dma-mapping.c (or whatever). dmabuf is a built in so it can call the function without exporting it just like block and hmm are doing.
The same code as in this vfio patch will get moved into the helper and vfio will call it under its dmabuf map/unmap ops.
The goal would be to make it much easier for other dmabuf exporters to switch from dma_map_resource() to this new dmabuf api which is safe for P2P.
Jason