Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp659715iog; Wed, 15 Jun 2022 09:33:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uqbIdP0aTQv9RwxBBSLQYYYFxOweHM1O+N7cWwvqbyaMmdaFxYtL5rNBVoPY2wozbxryZ7 X-Received: by 2002:a05:6a00:1305:b0:512:ebab:3b20 with SMTP id j5-20020a056a00130500b00512ebab3b20mr316592pfu.82.1655310793719; Wed, 15 Jun 2022 09:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655310793; cv=none; d=google.com; s=arc-20160816; b=k73vjilVoYeoHNTuvrDTivfphOYuLxD6Gl7JAvlFMCD6i8EhK8cS1if48cj30O42dy p6w0+6BbI+DBp75kzisGK6F0chBJan8rbpRUO8S75laXgcSvmzrF1EMXym41+ea4dkWc K+q3cedJ11z71ggMVA3S0M4Zl/EBz4L9nCHJnh3a7hRCLTUeUuBTlRQOfefiO2nTgFxd 5rk2VYB0gEqASsBsSyyvxIkpVi+i7feVWsJFTktgKxpTyqziAHXrX63+wEk8tmiR2l7O JgVSgZyl14ETngQ3vBnjniIPsN8p2pXQeUNG/SxbavapyZCOpfpXg8hIZ8mSambSOGcX EvBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=qwHhhptcjs675dAW5wV9iUf/ZWGXFcOtu4sOGzEzFjs=; b=IX/DW/W5WNOFjlffoJrUxBf/wqUMIgvmjy86OQwv4aiR1d/D1/yOwL2QCWsHT7IT4c 3mJwyvCg75rArajTz+6PkCC5ifSjOHlDe7jQqsZNbNEoMHLB771Z76a3xL6kFE1jFAhV K0cmZ+nJz+peT7P02mKQKZYoIc6VaXcHNTey3oqNakisgF6Pa0U8Yrsc+HxKfaK+Q6W8 2FHmS1MLJdkZiV3/reZEkwIrtP6jJREDmgxzwtS/SEse92fnsMpQtldC2GR6O1apVwXf Qt/IkvsFIeOa9QU+3q13y8xrH07NogFjkKyNp/8/hjLyjReWdtD7ZU6QxzUN0ALxmGIh TATQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=YmHHnpHX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a170902ecc700b001639977d222si19122582plh.406.2022.06.15.09.33.01; Wed, 15 Jun 2022 09:33:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=YmHHnpHX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233117AbiFOQOP (ORCPT + 99 others); Wed, 15 Jun 2022 12:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348940AbiFOQMz (ORCPT ); Wed, 15 Jun 2022 12:12:55 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2D721268; Wed, 15 Jun 2022 09:12:53 -0700 (PDT) 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=qwHhhptcjs675dAW5wV9iUf/ZWGXFcOtu4sOGzEzFjs=; b=YmHHnpHXs1wVWqcPzTDFNBWVuK Ufuk1/bP6jiv6cicN1+HWISek74RNoL6XDVXgD7MfiZHGSYeMFU1VMkaI3HdZvcSSTBlpEk975Xet lM/pDCalBifWIevWRcadscS84nE643nE1GCU6X2f1+CZXXJji+nzCGP+8WVgEXEXkQvOK3IIGXXtx 3weJ0ks+ru8GXZrthAQyc6RkGCl0P/w2PaCX0ZfOx+CCLOOuMC0RnH41/aJ+0ioIpS0vJoBDZxxr1 bWVy1Hbv4a7Yb3N5PcrE8KcO4tvJf4kt4PJqPiPl8lBLKgA/ER3s3R9j0Y92JXvdG9PRIgDrYaSu/ 0ccdiREQ==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o1VdS-0084iR-Tu; Wed, 15 Jun 2022 10:12:52 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1o1VdH-0004a3-92; Wed, 15 Jun 2022 10:12:39 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Stephen Bates , Christoph Hellwig , Dan Williams , Jason Gunthorpe , =?UTF-8?q?Christian=20K=C3=B6nig?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni , Ralph Campbell , Logan Gunthorpe , Jason Gunthorpe Date: Wed, 15 Jun 2022 10:12:17 -0600 Message-Id: <20220615161233.17527-6-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220615161233.17527-1-logang@deltatee.com> References: <20220615161233.17527-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, sbates@raithlin.com, hch@lst.de, jgg@ziepe.ca, christian.koenig@amd.com, ddutile@redhat.com, willy@infradead.org, daniel.vetter@ffwll.ch, jason@jlekstrand.net, dave.hansen@linux.intel.com, helgaas@kernel.org, dan.j.williams@intel.com, dave.b.minturn@intel.com, jianxin.xiong@intel.com, ira.weiny@intel.com, robin.murphy@arm.com, martin.oliveira@eideticom.com, ckulkarnilinux@gmail.com, logang@deltatee.com, jhubbard@nvidia.com, rcampbell@nvidia.com, jgg@nvidia.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Subject: [PATCH v7 05/21] dma-mapping: allow EREMOTEIO return code for P2PDMA transfers X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add EREMOTEIO error return to dma_map_sgtable() which will be used by .map_sg() implementations that detect P2PDMA pages that the underlying DMA device cannot access. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- kernel/dma/mapping.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index db7244291b74..9f65d1041638 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, if (ents > 0) debug_dma_map_sg(dev, sg, nents, ents, dir, attrs); else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM && - ents != -EIO)) + ents != -EIO && ents != -EREMOTEIO)) return -EIO; return ents; @@ -255,6 +255,8 @@ EXPORT_SYMBOL(dma_map_sg_attrs); * complete the mapping. Should succeed if retried later. * -EIO Legacy error code with an unknown meaning. eg. this is * returned if a lower level call returned DMA_MAPPING_ERROR. + * -EREMOTEIO The DMA device cannot access P2PDMA memory specified in + * the sg_table. This will not succeed if retried. */ int dma_map_sgtable(struct device *dev, struct sg_table *sgt, enum dma_data_direction dir, unsigned long attrs) -- 2.30.2