diff options
author | Martin Oliveira <martin.oliveira@eideticom.com> | 2021-07-29 14:15:28 -0600 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2021-08-09 17:13:05 +0200 |
commit | c4e0e892ab0579d4de3ca6d260d537fc16b39790 (patch) | |
tree | 69ef7391f43f041cdfa079e10851a43a707a02b5 /arch/powerpc/kernel | |
parent | af82fe85665d49bdb72dba66cd57e3bf95b71895 (diff) | |
download | linux-c4e0e892ab0579d4de3ca6d260d537fc16b39790.tar.gz linux-c4e0e892ab0579d4de3ca6d260d537fc16b39790.tar.bz2 linux-c4e0e892ab0579d4de3ca6d260d537fc16b39790.zip |
powerpc/iommu: return error code from .map_sg() ops
The .map_sg() op now expects an error code instead of zero on failure.
Propagate the error up if vio_dma_iommu_map_sg() fails.
ppc_iommu_map_sg() may fail either because of iommu_range_alloc() or
because of tbl->it_ops->set(). The former only supports returning an
error with DMA_MAPPING_ERROR and an examination of the latter indicates
that it may return arch-specific errors (for example,
tce_buildmulti_pSeriesLP()). Hence, coalesce all of those errors into
-EIO, per the documentation on dma_map_sgtable().
Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Geoff Levand <geoff@infradead.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/iommu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 2af89a5e379f..a8ec4fe42817 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -473,7 +473,7 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl, BUG_ON(direction == DMA_NONE); if ((nelems == 0) || !tbl) - return 0; + return -EINVAL; outs = s = segstart = &sglist[0]; outcount = 1; @@ -599,7 +599,7 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl, if (s == outs) break; } - return 0; + return -EIO; } |