Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp473826pxb; Thu, 30 Sep 2021 09:55:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi+1C4+mDEn5/Ri1/gR20r/os32liv298orouNAc4cmrwg4wgl1qvgLpn0ma0InT663M/W X-Received: by 2002:a17:90b:17ca:: with SMTP id me10mr14159842pjb.171.1633020903867; Thu, 30 Sep 2021 09:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633020903; cv=none; d=google.com; s=arc-20160816; b=sRutemgPAtE8k7ScH8HR1Izza+/QbKAhGSXptqaBIQmh5+ku+fvdrpXtqxqj9MvBpm CZrJvKDYCUbEIfJmq+llbITpFCYFwo329cgN+gZ4baxK4NgtI0ufHZST8xEj/xfLQJ5N 3j71umOUWAwT+euLwpNzlcBhLLVKKYywsGkg1uvQ/twVbLbiGX0eCfo9L2Uv4uzu+Xq1 zoN+QwEasBDHUyDIxLW0SF31vdAC21gL1y3hkggOQOQjtpgIz88qEnaWgMiQXp1lkylO jGZe5+VOLu6GvtHTooe8Lk6ckZOqbvxFYMimnXPWHarfQtq5hFR4F59nTlIi07QTgxZ7 zVZA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=DY98l6f/p37o1n6z2SAmaZFkiMoprnW0+Juc+mDOhCo=; b=fvCA2lXBNTP4StmByKUmdSzeLUF/QXrT1mtkvhe1q6K0leTtMnQ10FnqEzSYh23yN8 lPK51fZJS7Vh+UTbg8KJAvCvtAQk1Ev5pW1iGuyKfXWuR21Uv14kSNAShwjBntlo+aRK rEkTgpN7tzcZpKQafiQd12anDYwHaNmEXSg8kWuEKthfiNjdIRbkfJmosQEKP4LgDoQD xX4U6gn07nFwnVljdFLLwPymNdrIyA41g1DvwhHf/e958i65kRksb5q8EmkyI6grCV2o A5ExcaZZyTnZIfWmAvCdhQKFILPReW34rrgBwDIpwsVdVkkaVvj4HcafHyXsPPePXNSl wVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=pTfd2cTc; 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 k21si4117115pgh.347.2021.09.30.09.54.51; Thu, 30 Sep 2021 09:55:03 -0700 (PDT) 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=pTfd2cTc; 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 S1352440AbhI3QxV (ORCPT + 99 others); Thu, 30 Sep 2021 12:53:21 -0400 Received: from ale.deltatee.com ([204.191.154.188]:44024 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352384AbhI3QxT (ORCPT ); Thu, 30 Sep 2021 12:53:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:content-disposition; bh=DY98l6f/p37o1n6z2SAmaZFkiMoprnW0+Juc+mDOhCo=; b=pTfd2cTcyBzH2LpKD5iE+L5qG5 1YxVv6haFuR4tVxbCWzg77WlnQgwPvUMZwmaeKZ/dooUcIP5nxEHrl6iUZij4mssaKTc1px7tpQdx UMyTxmWTfEjMtRe2GIkYjVgqlDS1F3IkTZYJ19rOxetGBvpeebtdTkcvo2LLMm8BaIdwZQW6M+yDA xwkZTQaVYuM6i+YEvgQv3b/vT6jMo3j0z9ni8dqNTUIbj+9inuXDYYSM/W4MlssDZdeD33aXoOrpZ tIrW+L7X4llhAn1S/KznAKSdwTbT4O7Y3kK3KgNwTuziND3TP1yUKnxXkkTO5ob60fRu9UHxzZrhf 5AMobH0g==; Received: from s0106a84e3fe8c3f3.cg.shawcable.net ([24.64.144.200] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mVzHI-0004dm-2w; Thu, 30 Sep 2021 10:51:25 -0600 To: Chaitanya Kulkarni , "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_K=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 References: <20210916234100.122368-1-logang@deltatee.com> <20210916234100.122368-10-logang@deltatee.com> From: Logan Gunthorpe Message-ID: Date: Thu, 30 Sep 2021 10:51:22 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 24.64.144.200 X-SA-Exim-Rcpt-To: ckulkarnilinux@gmail.com, martin.oliveira@eideticom.com, robin.murphy@arm.com, ira.weiny@intel.com, helgaas@kernel.org, jianxin.xiong@intel.com, dave.hansen@linux.intel.com, jason@jlekstrand.net, dave.b.minturn@intel.com, andrzej.jakowski@intel.com, daniel.vetter@ffwll.ch, willy@infradead.org, ddutile@redhat.com, jhubbard@nvidia.com, christian.koenig@amd.com, jgg@ziepe.ca, dan.j.williams@intel.com, hch@lst.de, sbates@raithlin.com, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, chaitanyak@nvidia.com X-SA-Exim-Mail-From: logang@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=-10.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [PATCH v3 09/20] nvme-pci: check DMA ops when indicating support for PCI P2PDMA 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 On 2021-09-29 11:06 p.m., Chaitanya Kulkarni wrote: > Logan, > >> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >> index 7efb31b87f37..916750a54f60 100644 >> --- a/drivers/nvme/host/core.c >> +++ b/drivers/nvme/host/core.c >> @@ -3771,7 +3771,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, >> blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue); >> >> blk_queue_flag_set(QUEUE_FLAG_NONROT, ns->queue); >> - if (ctrl->ops->flags & NVME_F_PCI_P2PDMA) >> + if (ctrl->ops->supports_pci_p2pdma && >> + ctrl->ops->supports_pci_p2pdma(ctrl)) >> blk_queue_flag_set(QUEUE_FLAG_PCI_P2PDMA, ns->queue); >> >> ns->ctrl = ctrl; >> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h >> index 9871c0c9374c..fb9bfc52a6d7 100644 >> --- a/drivers/nvme/host/nvme.h >> +++ b/drivers/nvme/host/nvme.h >> @@ -477,7 +477,6 @@ struct nvme_ctrl_ops { >> unsigned int flags; >> #define NVME_F_FABRICS (1 << 0) >> #define NVME_F_METADATA_SUPPORTED (1 << 1) >> -#define NVME_F_PCI_P2PDMA (1 << 2) >> int (*reg_read32)(struct nvme_ctrl *ctrl, u32 off, u32 *val); >> int (*reg_write32)(struct nvme_ctrl *ctrl, u32 off, u32 val); >> int (*reg_read64)(struct nvme_ctrl *ctrl, u32 off, u64 *val); >> @@ -485,6 +484,7 @@ struct nvme_ctrl_ops { >> void (*submit_async_event)(struct nvme_ctrl *ctrl); >> void (*delete_ctrl)(struct nvme_ctrl *ctrl); >> int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); >> + bool (*supports_pci_p2pdma)(struct nvme_ctrl *ctrl); >> }; >> > > Is this new ops only needed for the PCIe transport ? or do you have > following patches to use this op for the other transports ? No, I don't think this will make sense for transports that are not based on PCI devices. > If it is only needed for the PCIe then we need to find a way to > not add this somehow... I don't see how we can do that. The core code needs to know whether the transport supports this and must have an operation to query it. Logan