linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org,
	linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, sparclinux@vger.kernel.org,
	iommu@lists.linux-foundation.org, linux-parisc@vger.kernel.org,
	xen-devel@lists.xenproject.org
Cc: Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Stephen Bates <sbates@raithlin.com>,
	Martin Oliveira <martin.oliveira@eideticom.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	"David S. Miller" <davem@davemloft.net>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH v2 14/21] sparc/iommu: return error codes from .map_sg() ops
Date: Fri, 23 Jul 2021 11:50:01 -0600	[thread overview]
Message-ID: <20210723175008.22410-15-logang@deltatee.com> (raw)
In-Reply-To: <20210723175008.22410-1-logang@deltatee.com>

From: Martin Oliveira <martin.oliveira@eideticom.com>

The .map_sg() op now expects an error code instead of zero on failure.

Returning an errno from __sbus_iommu_map_sg() results in
sbus_iommu_map_sg_gflush() and sbus_iommu_map_sg_pflush() returning an
errno, as those functions are wrappers around __sbus_iommu_map_sg().

Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/sparc/kernel/iommu.c     | 4 ++--
 arch/sparc/kernel/pci_sun4v.c | 4 ++--
 arch/sparc/mm/iommu.c         | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index a034f571d869..0589acd34201 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -448,7 +448,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
 	iommu = dev->archdata.iommu;
 	strbuf = dev->archdata.stc;
 	if (nelems == 0 || !iommu)
-		return 0;
+		return -EINVAL;
 
 	spin_lock_irqsave(&iommu->lock, flags);
 
@@ -580,7 +580,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
 	}
 	spin_unlock_irqrestore(&iommu->lock, flags);
 
-	return 0;
+	return -EINVAL;
 }
 
 /* If contexts are being used, they are the same in all of the mappings
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 9de57e88f7a1..d90e80fa5705 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -486,7 +486,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
 
 	iommu = dev->archdata.iommu;
 	if (nelems == 0 || !iommu)
-		return 0;
+		return -EINVAL;
 	atu = iommu->atu;
 
 	prot = HV_PCI_MAP_ATTR_READ;
@@ -619,7 +619,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
 	}
 	local_irq_restore(flags);
 
-	return 0;
+	return -EINVAL;
 }
 
 static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 0c0342e5b10d..9e3f6933ca13 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -256,7 +256,7 @@ static int __sbus_iommu_map_sg(struct device *dev, struct scatterlist *sgl,
 		sg->dma_address =__sbus_iommu_map_page(dev, sg_page(sg),
 				sg->offset, sg->length, per_page_flush);
 		if (sg->dma_address == DMA_MAPPING_ERROR)
-			return 0;
+			return -EIO;
 		sg->dma_length = sg->length;
 	}
 
-- 
2.20.1


  parent reply	other threads:[~2021-07-23 17:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 17:49 [PATCH v2 00/21] .map_sg() error cleanup Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 01/21] dma-mapping: Allow map_sg() ops to return negative error codes Logan Gunthorpe
2021-07-25  6:07   ` Christoph Hellwig
2021-07-23 17:49 ` [PATCH v2 02/21] dma-direct: Return appropriate error code from dma_direct_map_sg() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 03/21] iommu: Return full error code from iommu_map_sg[_atomic]() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 04/21] dma-iommu: Return error code from iommu_dma_map_sg() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 05/21] alpha: return error code from alpha_pci_map_sg() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 06/21] ARM/dma-mapping: return error code from .map_sg() ops Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 07/21] ARM/dma-mapping: don't set failed sg dma_address to DMA_MAPPING_ERROR Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 08/21] ia64/sba_iommu: return error code from sba_map_sg_attrs() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 09/21] MIPS/jazzdma: return error code from jazz_dma_map_sg() Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 10/21] powerpc/iommu: return error code from .map_sg() ops Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 11/21] powerpc/iommu: don't set failed sg dma_address to DMA_MAPPING_ERROR Logan Gunthorpe
2021-07-23 17:49 ` [PATCH v2 12/21] s390/pci: return error code from s390_dma_map_sg() Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 13/21] s390/pci: don't set failed sg dma_address to DMA_MAPPING_ERROR Logan Gunthorpe
2021-08-02 10:34   ` Niklas Schnelle
2021-07-23 17:50 ` Logan Gunthorpe [this message]
2021-07-23 17:50 ` [PATCH v2 15/21] sparc/iommu: " Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 16/21] parisc: return error code from .map_sg() ops Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 17/21] xen: swiotlb: return error code from xen_swiotlb_map_sg() Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 18/21] x86/amd_gart: return error code from gart_map_sg() Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 19/21] x86/amd_gart: don't set failed sg dma_address to DMA_MAPPING_ERROR Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 20/21] dma-mapping: return error code from dma_dummy_map_sg() Logan Gunthorpe
2021-07-23 17:50 ` [PATCH v2 21/21] dma-mapping: Disallow .map_sg operations from returning zero on error Logan Gunthorpe
2021-07-24  6:22   ` Rolf Eike Beer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210723175008.22410-15-logang@deltatee.com \
    --to=logang@deltatee.com \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.oliveira@eideticom.com \
    --cc=mpe@ellerman.id.au \
    --cc=robin.murphy@arm.com \
    --cc=sbates@raithlin.com \
    --cc=schnelle@linux.ibm.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).