From nobody Fri Nov 29 22:53:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=deltatee.com ARC-Seal: i=1; a=rsa-sha256; t=1626367631; cv=none; d=zohomail.com; s=zohoarc; b=VtbIJgfuZY3CmlsifuHQVhhC+I4Kh7H+7eewF99BueczUl65qK0nnLl1xx2/Cj5z3Vimt5dpZAMU0kyHaLLV4qKXoClEV9gAzB8+uzghkmH1V1oIO4KpbdPb/ZIgPn3Dxb4SREO8sFP/Dgjwq+gm2JziYfHv7de6B3Fs0zBwr00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626367631; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tVzBPY6/Bgdpsr8bmfZpwFmQV8rVEWLD9Ju+AXRRB/Q=; b=AxI/om2rv9IinhdLk4Go9vVi/KIH+5jWrgw0iJK3ijHkUyZY9X2hHXePLS4gjqtPve4DX5+BZlzKaF+tCoYDXArlAXs64Q1V7w+rcBJY91vnrxglsdbURNBc27HnXhGaF3hQBQeauevEogjMjGyJMPq8wKAEhkgK0RxoS3v93Hg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1626367631329720.0655509851206; Thu, 15 Jul 2021 09:47:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.156756.289375 (Exim 4.92) (envelope-from ) id 1m44Vm-0007ZM-Ul; Thu, 15 Jul 2021 16:46:58 +0000 Received: by outflank-mailman (output) from mailman id 156756.289375; Thu, 15 Jul 2021 16:46:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m44Vm-0007ZA-Pj; Thu, 15 Jul 2021 16:46:58 +0000 Received: by outflank-mailman (input) for mailman id 156756; Thu, 15 Jul 2021 16:46:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m44Vl-0008SS-PE for xen-devel@lists.xenproject.org; Thu, 15 Jul 2021 16:46:57 +0000 Received: from ale.deltatee.com (unknown [204.191.154.188]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2b8fd93e-e58c-11eb-8909-12813bfff9fa; Thu, 15 Jul 2021 16:46:15 +0000 (UTC) Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m44V1-0001yg-Li; Thu, 15 Jul 2021 10:46:12 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1m44Uo-0001nN-8x; Thu, 15 Jul 2021 10:45:58 -0600 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2b8fd93e-e58c-11eb-8909-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:MIME-Version:References:In-Reply-To: Message-Id:Date:Cc:To:From:content-disposition; bh=tVzBPY6/Bgdpsr8bmfZpwFmQV8rVEWLD9Ju+AXRRB/Q=; b=sT6nIphYRpQg2LPmIHPAN9+aTu GJh+kG/x4SM7ujeEOwTJw5ilEgyuKzytEd4BRwwLa0nLKahIc7+GQ9qJ4fA5Hu9384ZtjsbuG2b92 s51DHr3LmCxuscjDOqlyMZ7uwWmozJZCa9HkoIp885CAsrDYo/QLqd7pHbw54nqIDcuExXUrrVRfw hZPArbok7AiyAtDvc1e+GRkLRV8zgo/jTjvTVyD1VZI/lSLxAe/izWpR6ucAyWORMvAeNpU6T2dEP ToPwTmhEJvkkerb0Tb9hn7uJF1hapwuF3GeNQtxgW4wYN95t0lZGeB9IRWqetmlEjHzeTZ71Uml4S 1lVZm5YQ==; From: Logan Gunthorpe 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 , Marek Szyprowski , Robin Murphy , Stephen Bates , Martin Oliveira , Logan Gunthorpe , Russell King , Thomas Bogendoerfer Date: Thu, 15 Jul 2021 10:45:34 -0600 Message-Id: <20210715164544.6827-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210715164544.6827-1-logang@deltatee.com> References: <20210715164544.6827-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-parisc@vger.kernel.org, xen-devel@lists.xenproject.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, sbates@raithlin.com, martin.oliveira@eideticom.com, logang@deltatee.com, linux@armlinux.org.uk, tsbogend@alpha.franken.de X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH v1 06/16] ARM/dma-mapping: return error code from .map_sg() ops X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-ZohoMail-DKIM: pass (identity @deltatee.com) X-ZM-MESSAGEID: 1626367633093100001 Content-Type: text/plain; charset="utf-8" From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure, so propagate any errors that may happen all the way up. Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Cc: Russell King Cc: Thomas Bogendoerfer --- arch/arm/mm/dma-mapping.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c4b8df2ad328..8c286e690756 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -980,7 +980,7 @@ int arm_dma_map_sg(struct device *dev, struct scatterli= st *sg, int nents, { const struct dma_map_ops *ops =3D get_dma_ops(dev); struct scatterlist *s; - int i, j; + int i, j, ret; =20 for_each_sg(sg, s, nents, i) { #ifdef CONFIG_NEED_SG_DMA_LENGTH @@ -988,7 +988,8 @@ int arm_dma_map_sg(struct device *dev, struct scatterli= st *sg, int nents, #endif s->dma_address =3D ops->map_page(dev, sg_page(s), s->offset, s->length, dir, attrs); - if (dma_mapping_error(dev, s->dma_address)) + ret =3D dma_mapping_error(dev, s->dma_address); + if (ret) goto bad_mapping; } return nents; @@ -996,7 +997,7 @@ int arm_dma_map_sg(struct device *dev, struct scatterli= st *sg, int nents, bad_mapping: for_each_sg(sg, s, i, j) ops->unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, attrs); - return 0; + return ret; } =20 /** @@ -1622,7 +1623,7 @@ static int __iommu_map_sg(struct device *dev, struct = scatterlist *sg, int nents, bool is_coherent) { struct scatterlist *s =3D sg, *dma =3D sg, *start =3D sg; - int i, count =3D 0; + int i, count =3D 0, ret; unsigned int offset =3D s->offset; unsigned int size =3D s->offset + s->length; unsigned int max =3D dma_get_max_seg_size(dev); @@ -1634,8 +1635,10 @@ static int __iommu_map_sg(struct device *dev, struct= scatterlist *sg, int nents, s->dma_length =3D 0; =20 if (s->offset || (size & ~PAGE_MASK) || size + s->length > max) { - if (__map_sg_chunk(dev, start, size, &dma->dma_address, - dir, attrs, is_coherent) < 0) + ret =3D __map_sg_chunk(dev, start, size, + &dma->dma_address, dir, attrs, + is_coherent); + if (ret < 0) goto bad_mapping; =20 dma->dma_address +=3D offset; @@ -1648,8 +1651,9 @@ static int __iommu_map_sg(struct device *dev, struct = scatterlist *sg, int nents, } size +=3D s->length; } - if (__map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs, - is_coherent) < 0) + ret =3D __map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs, + is_coherent); + if (ret < 0) goto bad_mapping; =20 dma->dma_address +=3D offset; @@ -1660,7 +1664,7 @@ static int __iommu_map_sg(struct device *dev, struct = scatterlist *sg, int nents, bad_mapping: for_each_sg(sg, s, count, i) __iommu_remove_mapping(dev, sg_dma_address(s), sg_dma_len(s)); - return 0; + return ret; } =20 /** --=20 2.20.1