Commit ad8f36e4 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Christoph Hellwig
Browse files

iommu: return full error code from iommu_map_sg[_atomic]()



Convert to ssize_t return code so the return code from __iommu_map()
can be returned all the way down through dma_iommu_map_sg().

Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent c81be74e
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -2567,7 +2567,7 @@ size_t iommu_unmap_fast(struct iommu_domain *domain,
}
EXPORT_SYMBOL_GPL(iommu_unmap_fast);

static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
static ssize_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
		struct scatterlist *sg, unsigned int nents, int prot,
		gfp_t gfp)
{
@@ -2610,11 +2610,10 @@ static size_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
	/* undo mappings already done */
	iommu_unmap(domain, iova, mapped);

	return 0;

	return ret;
}

size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
ssize_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
		     struct scatterlist *sg, unsigned int nents, int prot)
{
	might_sleep();
@@ -2622,7 +2621,7 @@ size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
}
EXPORT_SYMBOL_GPL(iommu_map_sg);

size_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova,
ssize_t iommu_map_sg_atomic(struct iommu_domain *domain, unsigned long iova,
		    struct scatterlist *sg, unsigned int nents, int prot)
{
	return __iommu_map_sg(domain, iova, sg, nents, prot, GFP_ATOMIC);
+11 −11
Original line number Diff line number Diff line
@@ -414,9 +414,9 @@ extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
extern size_t iommu_unmap_fast(struct iommu_domain *domain,
			       unsigned long iova, size_t size,
			       struct iommu_iotlb_gather *iotlb_gather);
extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
extern ssize_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
		struct scatterlist *sg, unsigned int nents, int prot);
extern size_t iommu_map_sg_atomic(struct iommu_domain *domain,
extern ssize_t iommu_map_sg_atomic(struct iommu_domain *domain,
				   unsigned long iova, struct scatterlist *sg,
				   unsigned int nents, int prot);
extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
@@ -679,18 +679,18 @@ static inline size_t iommu_unmap_fast(struct iommu_domain *domain,
	return 0;
}

static inline size_t iommu_map_sg(struct iommu_domain *domain,
static inline ssize_t iommu_map_sg(struct iommu_domain *domain,
				   unsigned long iova, struct scatterlist *sg,
				   unsigned int nents, int prot)
{
	return 0;
	return -ENODEV;
}

static inline size_t iommu_map_sg_atomic(struct iommu_domain *domain,
static inline ssize_t iommu_map_sg_atomic(struct iommu_domain *domain,
				  unsigned long iova, struct scatterlist *sg,
				  unsigned int nents, int prot)
{
	return 0;
	return -ENODEV;
}

static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)