Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp46684pxh; Thu, 7 Apr 2022 13:32:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1AoqzPkSRbUUL0045244k2KcSKw/Abv4rmQdAwJ4H/dr79g0nkXWmSBd1WmH2aI0At67E X-Received: by 2002:a17:90a:ac04:b0:1cb:124f:3b6 with SMTP id o4-20020a17090aac0400b001cb124f03b6mr5269050pjq.116.1649363557694; Thu, 07 Apr 2022 13:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649363557; cv=none; d=google.com; s=arc-20160816; b=Z9FlzD/j8OLCHA7Xg+rR/gXgv5XWaSPlRpDSKS0agwPW6piQEZ52ib1nY1wp2TSJly qhXX7tkqYXJxQoddqsMKv1q/cRKJ17Huq0B84mxQoihnj7nXjMNxw1IczeDoEY2vrWD1 1Po9WgKgv45u5CdVl+6YkkWrdCjf7BCOO5ApSG+hvKwViFXd/HgbqXol/VGXurNVjwpl VAIzVnlTImskDxZ2Qd444hppoP8W28kci0Ua0Ia3ZVswhqwhp8pMWy24cdMt61omCjLw pdtL9UGK27jWYqjNbxCBO9nW1/EOIssrv46Pvc+gRbDogay2foOGS64yr+na116ekPvU JhMg== 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=BYkd81RxXbMGMLzLMZG19KaHBtsaeBvM8XA2CZujB0nrGv66xDijaVo/SXLRJorwB3 /nTX44QthaFzjGhPzHQc9rydPmPf1yQQTmw0Zg9KfW822Cweo6kUHy1YUIlbjIqy+UjC luNOm4OMmkC0tH7EDafMv2/r87TNOBaME+NUDo8+KR1aH+znhPDNwhXTAec42vwWvrwP 2zsS1xb90Vvr8UbUXS6As8+irf0TWAYsshyMizei7ZIvcjsM/tBYsudwTLUwKq7oo0Ji pVAX+e2sq80QBO7g/7BTOK/zvi4JXJuAcoLb1BgZWgFKhuFvNo1sGw68OXXn7L4q81/P KQGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=EOT6Ow6U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z5-20020a170902ccc500b00153b94147e7si670514ple.157.2022.04.07.13.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:32:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=EOT6Ow6U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C598362310; Thu, 7 Apr 2022 12:45:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346357AbiDGRa2 (ORCPT + 99 others); Thu, 7 Apr 2022 13:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346516AbiDGR1j (ORCPT ); Thu, 7 Apr 2022 13:27:39 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A24A2100A5C; Thu, 7 Apr 2022 10:23:49 -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=EOT6Ow6UdVvIY4DKNDl28DKbdr XL5XBU0ol/6KJ5yyMeQNVEigE3hI5Hq4vvc9uqb7OcthVIfXm8w4RQpIMDrwoU1JA19vDtZcFnUxv l7jAKiqD9ealgWX/ab89zuM+BD85MGrlTeWGSadgaMFatmmm0Y/RkNARI8eHFX1+dzqYiaQLyxl20 9DAAC0pIu2lI1X5Vo1nT8DW41LqG5BDQMmtDKYwT0g3x/8xszhQy7g+abnKiSf+qEbhvQuOU1qe3o SeUkhbs0C0A1KQMoBspjKBQVeW2vsuXxkiX5n3YFsn8s+JEHD0SNW9Y5gMID8PeWk3yZlXoJd2PpH ZryrM0ug==; 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 1ncUMM-002BBg-He; Thu, 07 Apr 2022 09:47:47 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.94.2) (envelope-from ) id 1ncUMC-00021T-0m; Thu, 07 Apr 2022 09:47:36 -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 , 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, 7 Apr 2022 09:47:01 -0600 Message-Id: <20220407154717.7695-6-logang@deltatee.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220407154717.7695-1-logang@deltatee.com> References: <20220407154717.7695-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 lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Subject: [PATCH v6 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