Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1417810pxb; Fri, 6 Nov 2020 09:07:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwe8bDSGeB+ywN4E+7sj7Qcr7K2QCHxWi+yY08aPkPLUSs4f+i02HoVy2fWN760oqS7pudW X-Received: by 2002:a17:906:4944:: with SMTP id f4mr2803761ejt.231.1604682454032; Fri, 06 Nov 2020 09:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604682454; cv=none; d=google.com; s=arc-20160816; b=kisEAyCXt2eWCrfFGOqhiI8E48+g6TrjJLAYKiHtIuvTv0qQtpTJTqrhblfVmXt83Q HlxLnnVRcNVqvDij4lWYywZwlHW8Eek55ee6WWNMJHXp7osAlJoT8WJmPI0iZIP+8YtQ AWeZ6TUd+HWPBpCtPaRKuoC7+gJ5AQEzGdWcyHm2o9aRcDH2agyejsvzpGmcsV+guR0/ 3Ggqz52gbK2W/+fGFB2h6xlE744ZGnoEZwvVQtGisYGoa2gLT9qUlb12ZiPII3S+AvCo 1WgO25JatHTbXLBrHRdawxg8u3fM7oSSXb0rpC+SAH0U5/iMDN97Q6V4j9bnT5ovoaJc fntg== 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=/ib4hcAfbiHMdLX/8DBMNJM6Gg1f+72PJ0ND9MJ2JPY=; b=Orw0HrHLbsGtiOBXdbZmZnjDPIa5cHSF5jhq0LPnu7MpUvA41OuH5zWSl5euxEim5P OxTgK8a5YN40kOHbAhZ0EalysXWGmNjU3xm1zveopQa9mY6GIPjq37UTpAo6V64PErSn PypDHETDxGuJUR0uh7Nl4Uq9EkxzI7/89qAjQ733A3BZ1lNnJkP3Qbp7zghtzR4FlHJb UQLQ0+PpPbRZ/nrcssNqU5IpSrZS/6GZT4ClpOWnJt4RaGJR4KWll24QDzloYIuUAOiX xBL/Y25iMhEb5I82/IcNxr0ODfiX8t8LwedzhbWhqeqid+PjGHBVi2rY3UIQMJnrLBcv XH+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=LKLCRs5E; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc10si1588823edb.156.2020.11.06.09.07.06; Fri, 06 Nov 2020 09:07:34 -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=fail header.i=@deltatee.com header.s=20200525 header.b=LKLCRs5E; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727886AbgKFRBx (ORCPT + 99 others); Fri, 6 Nov 2020 12:01:53 -0500 Received: from ale.deltatee.com ([204.191.154.188]:57670 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727763AbgKFRA6 (ORCPT ); Fri, 6 Nov 2020 12:00:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/ib4hcAfbiHMdLX/8DBMNJM6Gg1f+72PJ0ND9MJ2JPY=; b=LKLCRs5E1fTNVSfyLyggO9F00J ebA/QlSU1neMqjpg6RXX69lynbZmYxAVQReH4MRpE300YyrdAKMEEs0R9dBNTt2+Sn9fa5ZYuR2qE BMJGKFEk2kv8lZODOz7/Dtmjj2ir+gpt5cQvYp7xvFZcw5Dg01QCyOzB1IZZCZoSDRM2c2UiBycyt lu6DdPugsSp10V+yx5M0RwBAleHSQT17iLdK3N3AvfCMkGd9ZVFZwgiGPAbpHTORNODrCOzamsd3j ftrZdcJQIcIIK7uAVQf127ZdItrwzvKQvj7WJHXN/+D/ivdDaNbuJLgvyxC5ssGGyLKrGSo+xNcA5 XYQETn/Q==; Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb56d-0002PX-U2; Fri, 06 Nov 2020 10:00:57 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1kb56V-0004tQ-Od; Fri, 06 Nov 2020 10:00:47 -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?= , Ira Weiny , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Logan Gunthorpe Date: Fri, 6 Nov 2020 10:00:34 -0700 Message-Id: <20201106170036.18713-14-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201106170036.18713-1-logang@deltatee.com> References: <20201106170036.18713-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, dan.j.williams@intel.com, iweiny@intel.com, jhubbard@nvidia.com, ddutile@redhat.com, willy@infradead.org, daniel.vetter@ffwll.ch, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_NO_TEXT autolearn=ham autolearn_force=no version=3.4.2 Subject: [RFC PATCH 13/15] block: Set FOLL_PCI_P2PDMA in bio_map_user_iov() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be passed from userspace and enables the NVMe passthru requests to use P2PDMA pages. Signed-off-by: Logan Gunthorpe --- block/blk-map.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block/blk-map.c b/block/blk-map.c index 21630dccac62..cad8fcfe4f17 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -245,6 +245,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, { unsigned int max_sectors = queue_max_hw_sectors(rq->q); struct bio *bio, *bounce_bio; + unsigned int flags = 0; int ret; int j; @@ -256,13 +257,17 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, return -ENOMEM; bio->bi_opf |= req_op(rq); + if (blk_queue_pci_p2pdma(rq->q)) + flags |= FOLL_PCI_P2PDMA; + while (iov_iter_count(iter)) { struct page **pages; ssize_t bytes; size_t offs, added = 0; int npages; - bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs); + bytes = iov_iter_get_pages_alloc_flags(iter, &pages, LONG_MAX, + &offs, flags); if (unlikely(bytes <= 0)) { ret = bytes ? bytes : -EFAULT; goto out_unmap; -- 2.20.1