Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp696576imw; Fri, 8 Jul 2022 10:02:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tsxrOfhBTbbrnN2K933dfqsQdhjm0SISeQUiJM6zSVk6n9EPPIS4bcMeG/yJ54PEPxTQ/L X-Received: by 2002:a05:6a00:1581:b0:525:9d99:cce8 with SMTP id u1-20020a056a00158100b005259d99cce8mr4583304pfk.51.1657299778566; Fri, 08 Jul 2022 10:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657299778; cv=none; d=google.com; s=arc-20160816; b=WmiwiXPC2sy//Wj8FJfIl2UzgDxKKjJLIXX4AVm/713W9gXn1idSLHal53VXFOwXnv bwJcdWEDQly1fupqMHxo6cEOa+WxNnXNQctWZTLm91ft9ktb+biObv7IbQNr0wHtn5Pq +tMBwP6tC6ryGpJmPsznsYr4oW6ZKrBWtI/29IVH8bqGmPfZkVqjxhgcpONY7wnDITGm Csu9b6lrU8SX4x5jgWwXGfbff5z5Kly0OVncCHGdcqN2SL6E2ii5Gn/cgUFSQtY4JxK1 1QGagQ7rtHZKY7GP97kUjP5lyqahsHpe4Mk2l7AobITwruOZbdUYHVKOvDs3IRl03UCT buZQ== 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=uJjrxZhZdYVYZtXKOvole/gSNQLljW7DYXsmqSCAvGo=; b=eH4mtlnCbamICwSq4mH58XXKHper3NEExTSuNHEsRstMUbmlXvLfccFDfAEcoLJhTw Q/jHS4HB6zSotuE6cdgyJkDtnVDYoOFEZ2cCZJHzNB0dZdklKcYHAsc9RMkYy+8lMcpU 16WY+gVLbVbt6ZEEmAbP0K12deACbC7RA8M15rhh9vs2S9B4ahF///i4zbg3bWgqkNuZ XbIyCXd+G61vqLwq37QW4CwsLAoMSsLk7GyO270DDhMQb1/8e7fYx1/F+AX9dR4OzES6 EUdUiPSeL/zvA8VN1tssXxtJXR3tLXsfqHRlqiIjuTIXOjVtWuavoHGZB3EE+jFgxc6D qDxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=CjHcrl1a; 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 t5-20020a17090a950500b001df518c9e46si2734749pjo.190.2022.07.08.10.02.39; Fri, 08 Jul 2022 10:02:58 -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=CjHcrl1a; 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 S239344AbiGHQvZ (ORCPT + 99 others); Fri, 8 Jul 2022 12:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238994AbiGHQvP (ORCPT ); Fri, 8 Jul 2022 12:51:15 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5E96D562; Fri, 8 Jul 2022 09:51:15 -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=uJjrxZhZdYVYZtXKOvole/gSNQLljW7DYXsmqSCAvGo=; b=CjHcrl1a6j4yr4iGsb795tcytT NECRTdE0jXeH/1rMGVNU+FRvl8kMJk67LTeXkAcBYDiINeM/wNgAVoVjeZGn+fmrt0N+T+27HCINi N5FNXo1CgxhwwgwlHRp6aC2ClGYKQtOQn5BmEMVimNVOlDfmOCMdJTJ3JUEA3lcGW/gZO9+qOd9Nu h8etgYBVAnEe83NrwXLYD06OUC9sGDW15wE6Nb1dzE9AwEcmUfF+zzlNQ14ZQ6lAfMcd7ZHogxoFc EFwW+Xu7ic3SGnE9yQnorciCErOi3B1M/KP8gv6Dp7HzKk3mtenVF9Wa7IyLPSEB2eB2v1eSTpRov gmxUaGkA==; 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 1o9rCB-009xkJ-SC; Fri, 08 Jul 2022 10:51:13 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1o9rC9-0001Jv-H0; Fri, 08 Jul 2022 10:51:09 -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, iommu@lists.linux.dev 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: Fri, 8 Jul 2022 10:50:55 -0600 Message-Id: <20220708165104.5005-5-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220708165104.5005-1-logang@deltatee.com> References: <20220708165104.5005-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, iommu@lists.linux.dev, 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 v8 04/13] 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 Reviewed-by: Christoph Hellwig --- kernel/dma/mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index db7244291b74..20e70fa71091 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,9 @@ 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