Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp20999imm; Wed, 12 Sep 2018 17:13:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZfvA3/s5t4p+cg6V5RJGLClh0HA6GMIFjVfjUysO4VFZWGk0hG17jW1woK2pxrqdGQwYFL X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr4766309plg.152.1536797620662; Wed, 12 Sep 2018 17:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536797620; cv=none; d=google.com; s=arc-20160816; b=bXI2ziXTVCR9y96wh90D+4GPAKQhbFJL93jAtYCfs9Z9zWEkekzZ3hms7VVnDmEwLr mUtNJH24aavpj1Ysd5gQ9sfILMQwnuf3O0gVDQHJNDoeZPSB3pPmMa99QsSMXXOiqHn/ CbWyoHFNfYJ5tS7AOXNDNC2DAJ1o6NWZ/9BQi/D9wbM5iSGoiNHHrc78cewrAI/bX/C0 8yc/Zco3dhs0slwG+ivjQ5oykP8lcKjvs7qLMk0zFvCkAu5oUkHLgT7ZAaxlZE41YwFu PqXRFE5DSrxZ1c1jBhN3d5zbNWaEXvgFYKoLTHggQVvFt7EsJYIRLi//p7t+WNyNt6VC cQlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=lMYKsufiARXkXRhUn67/PITIEl6EoPXkdwTYY7UAEmA=; b=H1Y+3m+jffR34BmTHBsPT1fsddH67DvXJkBkJUoh2bRSfqpcRFpH2FvwZlfv1t79bk 1xYPyK0Ijdz97l4Z21MpbRPKrMylrRrsh/9OCnLNcpSOk0hBnML5IAJStQbAhtjwoA+D jrIqMsSGD5XZNd9fkOcH+p3xL/mpYvXT3I9rzLN5u2D0Uzsb3JmUBzOJLXZNh+zPic74 sAAJMD+eDtO3HtKfEvnRCAHPPQ0sdmSRaCkkC8xF81hsvlwgsgEuVMYaZzHBe/4TMmur hEKNmD9+b3lIheWIml0IG89g2LzhJe3TnO+wzpfJfH5j7Tyt+/+kAJRB1jzFXmVbED1t 2PPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10-v6si2460863pgg.195.2018.09.12.17.12.56; Wed, 12 Sep 2018 17:13:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbeIMFTE (ORCPT + 99 others); Thu, 13 Sep 2018 01:19:04 -0400 Received: from ale.deltatee.com ([207.54.116.67]:38626 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbeIMFTC (ORCPT ); Thu, 13 Sep 2018 01:19:02 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0FEl-0006bF-QX; Wed, 12 Sep 2018 18:12:06 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1g0FEl-00015c-Kv; Wed, 12 Sep 2018 18:11:59 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, linux-block@vger.kernel.org Cc: Stephen Bates , Christoph Hellwig , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Benjamin Herrenschmidt , Alex Williamson , =?UTF-8?q?Christian=20K=C3=B6nig?= , Jens Axboe , Logan Gunthorpe Date: Wed, 12 Sep 2018 18:11:50 -0600 Message-Id: <20180913001156.4115-8-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913001156.4115-1-logang@deltatee.com> References: <20180913001156.4115-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-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-block@vger.kernel.org, sbates@raithlin.com, hch@lst.de, sagi@grimberg.me, bhelgaas@google.com, jgg@mellanox.com, maxg@mellanox.com, keith.busch@intel.com, dan.j.williams@intel.com, benh@kernel.crashing.org, jglisse@redhat.com, alex.williamson@redhat.com, christian.koenig@amd.com, axboe@kernel.dk, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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.1 Subject: [PATCH v6 07/13] block: Add PCI P2P flag for request queue and check support for requests X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org QUEUE_FLAG_PCI_P2P is introduced meaning a driver's request queue supports targeting P2P memory. When a request is submitted we check if PCI P2PDMA memory is assigned to the first page in the bio. If it is, we ensure the queue it's submitted to supports it, and enforce REQ_NOMERGE. Signed-off-by: Logan Gunthorpe --- include/linux/blkdev.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index d6869e0e2b64..7bf80ca802e1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -699,6 +699,7 @@ struct request_queue { #define QUEUE_FLAG_SCSI_PASSTHROUGH 27 /* queue supports SCSI commands */ #define QUEUE_FLAG_QUIESCED 28 /* queue has been quiesced */ #define QUEUE_FLAG_PREEMPT_ONLY 29 /* only process REQ_PREEMPT requests */ +#define QUEUE_FLAG_PCI_P2PDMA 30 /* device supports pci p2p requests */ #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_SAME_COMP) | \ @@ -731,6 +732,8 @@ bool blk_queue_flag_test_and_clear(unsigned int flag, struct request_queue *q); #define blk_queue_dax(q) test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags) #define blk_queue_scsi_passthrough(q) \ test_bit(QUEUE_FLAG_SCSI_PASSTHROUGH, &(q)->queue_flags) +#define blk_queue_pci_p2pdma(q) \ + test_bit(QUEUE_FLAG_PCI_P2PDMA, &(q)->queue_flags) #define blk_noretry_request(rq) \ ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ -- 2.19.0