PCI/P2PDMA: Add PCI p2pmem DMA mappings to adjust the bus offset
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 4 Oct 2018 21:27:37 +0000 (15:27 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 17 Oct 2018 17:18:16 +0000 (12:18 -0500)
commit977196b8c5b20b901acb0042579e30d7fa55790a
treeef3a0c1ee710fc331eb1fdfc0fcaccdca0308776
parentcbb8ca69fcbb2c82f70abcbb75b6ea8579236210
PCI/P2PDMA: Add PCI p2pmem DMA mappings to adjust the bus offset

The DMA address used when mapping PCI P2P memory must be the PCI bus
address.  Thus, introduce pci_p2pmem_map_sg() to map the correct addresses
when using P2P memory.

Memory mapped in this way does not need to be unmapped and thus if we
provided pci_p2pmem_unmap_sg() it would be empty.  This breaks the expected
balance between map/unmap but was left out as an empty function doesn't
really provide any benefit.  In the future, if this call becomes necessary
it can be added without much difficulty.

For this, we assume that an SGL passed to these functions contain all P2P
memory or no P2P memory.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
drivers/pci/p2pdma.c
include/linux/memremap.h
include/linux/pci-p2pdma.h