On Wed, Sep 07, 2022 at 12:23:28PM -0300, Jason Gunthorpe wrote: > 2) DMABUF abuses dma_map_resource() for P2P and thus doesn't work in > certain special cases. Not just certain special cases, but one of the main use cases. Basically P2P can happen in two ways: a) through a PCIe switch, or b) through connected root ports The open code version here only supports a), only supports it when there is no offset between the 'phyiscal' address of the BAR seen PCIe endpoint and the Linux way. x86 usually (always?) doesn't have an offset there, but other architectures often do. Last but not least I don't really see how the code would even work when an IOMMU is used, as dma_map_resource will return an IOVA that is only understood by the IOMMU itself, and not the other endpoint. How was this code even tested?