On 2019-05-23 3:50 a.m., Christoph Hellwig wrote: > On Thu, May 23, 2019 at 09:48:40AM +0000, Koenig, Christian wrote: >> I don't adjust the address manually anywhere. I just call >> dma_map_resource() and use the resulting DMA address to access the other >> devices PCI BAR. >> >> At least on my test system (AMD CPU + AMD GPUs) this seems to work >> totally fine. Currently trying to find time and an Intel box to test it >> there as well. > > The problem shows up if pci_bus_address() returns a different address > than pci_resource_start(), should be easy to check if that happens. > IIRC it is something mostly seen on embedded SOCs. > I think it's a bit more complicated then that: If you're calling dma_map_resource() to program the IOMMU then I'm pretty sure you'd want to use the pci_resource_start() address as the phys_addr_t. If you're bypassing the root complex (like the current p2pdma code enforces), then you'd simply use a pci_bus_address() directly as the dma_addr and would not program the IOMMU at all seeing it's not involved (which is what is currently done). Logan