Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1016286pxb; Fri, 28 Jan 2022 15:53:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNW4wBIKn6TiHBoWN/Qf4lwgM3kncvLwtd1vq7Jr5g11VYq5T3vfQ/4blZh3eEq7UHq2XA X-Received: by 2002:a17:902:cec2:: with SMTP id d2mr11067480plg.153.1643414016865; Fri, 28 Jan 2022 15:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643414016; cv=none; d=google.com; s=arc-20160816; b=zLp3tp1ImARke8dnY3HpVWVH0SQvvjrXviH2tKPJCExpSnIpJ3hKV24co9ntDoKR+3 djfFEqcWll5PnIknNVA7xqJFn8NPMXmUqsAtMd7U6IUFrT5nJt0h4FWu5ZoNuv8pLu4K xKikgS8BFfWbhSSkdN0o7w3eV+8Qa3QEJ4axoE7YbEEbGgMIi3StrPVsfaZJwXCv8c8q afwcARvnXqWV3d7ooK0XT7sFo1mWjPEz/DWlJSBmu2B2//ECfQVs/76NoMxZ5WxjRXiA xrq/L1+B1Wd7fHHpVM7kekQz2wRc7SoPL897CtzmmU0OFEd4vil7fidyq9o3InNVJfg6 wggw== 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=3aZ2AYK60CEaIE70gWhhj4/fir+nnPw5quNT7e3qCog=; b=IHr+oR4xuq2J8FGcrFYFCO5Rxrm21/mciFLeCh2gaNWr8zKQKZMLkhNHb7pxLMGdY4 5p49IdnPPA/91Aw7fkWM3mIb9bzVp5fsF1brayhafBKtgH5+yW8RTPjXadLKJdaacN4+ mNV0/4xzZovcM13FPARjPgCiZ8Y21d1Zx3ylNuqLTZQe+Ukhw+XYAP9b8MTMD/N9f5/8 oy4TU6pcaUIWQ4+Hqme2JAjhWrhj5U7td4ZPVV89H7AoKPzKncVEztvCx/vTMUjQZlgJ qLEA//aHm4FxhQ9QAlO2d5VUMi2duEc1BdXwRFHOHiyOcgmr5U97D54zui8FcFXnLznz VLeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=TbtXdvF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x16si6921546plg.384.2022.01.28.15.53.25; Fri, 28 Jan 2022 15:53:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=TbtXdvF1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1345107AbiA1A1o (ORCPT + 99 others); Thu, 27 Jan 2022 19:27:44 -0500 Received: from ale.deltatee.com ([204.191.154.188]:47180 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344613AbiA1A0e (ORCPT ); Thu, 27 Jan 2022 19:26:34 -0500 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=3aZ2AYK60CEaIE70gWhhj4/fir+nnPw5quNT7e3qCog=; b=TbtXdvF1neCjSLnA8Y5arFrbEW 7X/js5p1SwkTImoZEymFLHDsRMoXgV9VaQUQR/6s0f1UsJzlIF7Z8FqTJ1ZK2mfP93+kmYBdBDHHa XI4wTZ33KDZyUDOwz+wnhjRlfReo0msjPUyHb8cL/3TGCM79MP8K7cSrxbGpamidLLtozYRagtUFq xaDJeZpSuxVZr2tuGN9hdddXdaGaYTZmt0HgULTITqjAX1SFjLRBwuLjMeylPa1W4OTEmecbmOJsr ChjJuWMVLjqUvwVOpkz2YQvSyyjicCkT5tp4WIw8QaSxoMVqHCWoV0M2o4CqG9SETfDvdeYQ7EdRj f0xTlhuQ==; 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 1nDF5v-005OcX-Kr; Thu, 27 Jan 2022 17:26:31 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1nDF5n-0001cU-2X; Thu, 27 Jan 2022 17:26:19 -0700 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 , Jakowski Andrzej , 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: Thu, 27 Jan 2022 17:25:57 -0700 Message-Id: <20220128002614.6136-8-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220128002614.6136-1-logang@deltatee.com> References: <20220128002614.6136-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, andrzej.jakowski@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 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.6 Subject: [PATCH v5 07/24] 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 9478eccd1c8e..c056a1468189 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