Skip to content

Commit 7c2645a

Browse files
lsgunthChristoph Hellwig
authored andcommitted
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: Logan Gunthorpe <logang@deltatee.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 5e180ff commit 7c2645a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

kernel/dma/mapping.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
197197
if (ents > 0)
198198
debug_dma_map_sg(dev, sg, nents, ents, dir, attrs);
199199
else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM &&
200-
ents != -EIO))
200+
ents != -EIO && ents != -EREMOTEIO))
201201
return -EIO;
202202

203203
return ents;
@@ -255,6 +255,9 @@ EXPORT_SYMBOL(dma_map_sg_attrs);
255255
* complete the mapping. Should succeed if retried later.
256256
* -EIO Legacy error code with an unknown meaning. eg. this is
257257
* returned if a lower level call returned DMA_MAPPING_ERROR.
258+
* -EREMOTEIO The DMA device cannot access P2PDMA memory specified in
259+
* the sg_table. This will not succeed if retried.
260+
*
258261
*/
259262
int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
260263
enum dma_data_direction dir, unsigned long attrs)

0 commit comments

Comments
 (0)