Logan Gunthorpe 5e180ff326 PCI/P2PDMA: Introduce helpers for dma_map_sg implementations
Add pci_p2pdma_map_segment() as a helper for dma_map_sg()
implementations. It takes an scatterlist segment that must point to a
pci_p2pdma struct page and will map it if the mapping requires a bus
address.

The return value indicates whether the mapping required a bus address
or whether the caller still needs to map the segment normally. If the
segment should not be mapped, -EREMOTEIO is returned.

This helper uses a state structure to track the changes to the
pgmap across calls and avoid needing to lookup into the xarray for
every page.

The prototype for the helper is added to dma-map-ops.h as it is only
useful to dma map implementations and don't need to pollute the public
pci-p2pdma header.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-07-26 07:27:47 -04:00
..
2022-06-02 12:11:25 -07:00
2022-05-31 09:56:54 -07:00
2021-06-16 17:20:40 -05:00
2022-03-07 12:06:10 -07:00
2020-07-29 14:25:18 -05:00
2022-03-09 18:30:46 -06:00
2019-07-09 07:24:53 -05:00
2022-05-31 09:56:54 -07:00
2022-05-27 15:25:10 -07:00
2022-05-31 09:56:54 -07:00
2022-01-16 08:08:11 +02:00
2022-03-22 11:23:53 -05:00
2021-02-10 16:46:29 -06:00
2022-03-22 17:16:21 -05:00
2021-09-28 13:43:17 -05:00
2020-08-05 18:23:14 -05:00