From: Logan Gunthorpe Subject: [PATCH v3 17/21] xen: swiotlb: return error code from xen_swiotlb_map_sg() Date: Thu, 29 Jul 2021 14:15:35 -0600 Message-ID: <20210729201539.5602-18-logang@deltatee.com> References: <20210729201539.5602-1-logang@deltatee.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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=SvEzwpNxmVfyllnMOG86hKyCuFZgCTrDE53Ra6OCzdU=; b=WiNvtwJWsvaWnq8SYmDQL8Ejad kH1OHkO85WUX8V6h92JFJR4xzaBqNooRZC0dTcIQp+I0ka90sKEZo9dxN8NsH82EZJEy/3xG7TAWh /sXbBOqrMxoadkyNfMXimu8pd4Agw8sVOzNLOSstc8uNoV9t6HvaGetGv0LeTxzfEXWU9iU6/cWGy w4tLTaS+Fq7Pp4bbmhNN3Bz4G1KCh3RZ96+TBQ3yzo+FtsWXDlffmD/JEOHEGhiGj+bTKS3UxB/lf 7OUmTUn9JsDjcIpVl7kARu3aX9kwjXt6JGCGiMse2DWCpu72hJcFNV7zOEnDl4AZ+N6YF/CyfpBQY tTCEnQog==; In-Reply-To: <20210729201539.5602-1-logang-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Sender: "iommu" To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org Cc: Juergen Gross , Stefano Stabellini , Konrad Rzeszutek Wilk , Robin Murphy , Martin Oliveira , Stephen Bates , Boris Ostrovsky , Logan Gunthorpe , Christoph Hellwig From: Martin Oliveira The .map_sg() op now expects an error code instead of zero on failure. xen_swiotlb_map_sg() may only fail if xen_swiotlb_map_page() fails, but xen_swiotlb_map_page() only supports returning errors as DMA_MAPPING_ERROR. So coalesce all errors into EIO per the documentation for dma_map_sgtable(). Signed-off-by: Martin Oliveira Signed-off-by: Logan Gunthorpe Reviewed-by: Boris Ostrovsky Cc: Konrad Rzeszutek Wilk Cc: Juergen Gross Cc: Stefano Stabellini --- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 24d11861ac7d..85d58b720a24 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -509,7 +509,7 @@ xen_swiotlb_map_sg(struct device *dev, struct scatterlist *sgl, int nelems, out_unmap: xen_swiotlb_unmap_sg(dev, sgl, i, dir, attrs | DMA_ATTR_SKIP_CPU_SYNC); sg_dma_len(sgl) = 0; - return 0; + return -EIO; } static void -- 2.20.1