Commit 7c2645a2 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Christoph Hellwig

dma-mapping: allow EREMOTEIO return code for P2PDMA transfers

Add EREMOTEIO error return to dma_map_sgtable() which will be used
by .map_sg() implementations that detect P2PDMA pages that the
underlying DMA device cannot access.
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5e180ff3
...@@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, ...@@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
if (ents > 0) if (ents > 0)
debug_dma_map_sg(dev, sg, nents, ents, dir, attrs); debug_dma_map_sg(dev, sg, nents, ents, dir, attrs);
else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM && else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM &&
ents != -EIO)) ents != -EIO && ents != -EREMOTEIO))
return -EIO; return -EIO;
return ents; return ents;
...@@ -255,6 +255,9 @@ EXPORT_SYMBOL(dma_map_sg_attrs); ...@@ -255,6 +255,9 @@ EXPORT_SYMBOL(dma_map_sg_attrs);
* complete the mapping. Should succeed if retried later. * complete the mapping. Should succeed if retried later.
* -EIO Legacy error code with an unknown meaning. eg. this is * -EIO Legacy error code with an unknown meaning. eg. this is
* returned if a lower level call returned DMA_MAPPING_ERROR. * returned if a lower level call returned DMA_MAPPING_ERROR.
* -EREMOTEIO The DMA device cannot access P2PDMA memory specified in
* the sg_table. This will not succeed if retried.
*
*/ */
int dma_map_sgtable(struct device *dev, struct sg_table *sgt, int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
enum dma_data_direction dir, unsigned long attrs) enum dma_data_direction dir, unsigned long attrs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment