On 2025-07-25 12:54, Leon Romanovsky wrote: >> The solution that would make more sense to me would be for either >> dma_iova_try_alloc() or another helper in dma-iommu.c to handle the >> P2PDMA case. dma-iommu.c already uses those same interfaces and thus >> there would be no need to export the low level helpers from the p2pdma code. > > I had same idea in early versions of DMA phys API discussion and it was > pointed (absolutely right) that this is layering violation. Respectfully, I have to disagree with this. Having the layer (ie. dma-iommu) that normally checks how to handle a P2PDMA request now check how to handle these DMA requests is the exact opposite of a layering violation. Expecting every driver that wants to do P2PDMA to have to figure out for themselves how to map the memory before calling into the DMA API doesn't seem like a good design choice to me. > So unfortunately, I think that dma*.c|h is not right place for p2p > type check. dma*.c is already where those checks are done. I'm not sure patches to remove the code from that layer and put it into the NVMe driver would make a lot of sense (and then, of course, we'd have to put it into every other driver that wants to participate in p2p transactions). Logan
- Re: [PATCH 02/10] PCI/P2PDMA: Introduce p2pdma_pr... Leon Romanovsky
- Re: [PATCH 02/10] PCI/P2PDMA: Introduce p2pdm... Leon Romanovsky
- Re: [PATCH 02/10] PCI/P2PDMA: Introduce p2pdm... Jason Gunthorpe
- Re: [PATCH 02/10] PCI/P2PDMA: Introduce p... Leon Romanovsky
- Re: [PATCH 02/10] PCI/P2PDMA: Introd... Leon Romanovsky
- Re: [PATCH 02/10] PCI/P2PDMA: Introduce p2pdma_provid... Jason Gunthorpe
- [PATCH 05/10] PCI/P2PDMA: Export pci_p2pdma_map_type() fun... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_p2pdma_map_t... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_p2pdma_m... Logan Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_p2pd... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_... Logan Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Export... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_p2pd... Jason Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_... Logan Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Export... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Ex... Logan Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Ex... Jason Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Ex... Logan Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Ex... Jason Gunthorpe
- Re: [PATCH 05/10] PCI/P2PDMA: Ex... Leon Romanovsky
- Re: [PATCH 05/10] PCI/P2PDMA: Export pci_p2pdma_m... Leon Romanovsky