From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me
Cc: baolin.wang@linux.alibaba.com, baolin.wang7@gmail.com,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
Date: Tue, 23 Jun 2020 21:24:33 +0800 [thread overview]
Message-ID: <eab18c7696ea0e34a6ab0371d7d17ad45d1566ce.1592916850.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1592916850.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1592916850.git.baolin.wang@linux.alibaba.com>
Introduce a new capability macro to indicate if the controller
supports the memory buffer or not, instead of reading the
NVME_REG_CMBSZ register.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
drivers/nvme/host/pci.c | 2 +-
include/linux/nvme.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4b4b7b7..00c2701 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1760,7 +1760,7 @@ static void nvme_map_cmb(struct nvme_dev *dev)
struct pci_dev *pdev = to_pci_dev(dev->dev);
int bar;
- if (dev->cmb_size)
+ if (!NVME_CAP_CMBS(dev->ctrl.cap) || dev->cmb_size)
return;
dev->cmbsz = readl(dev->bar + NVME_REG_CMBSZ);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 5ce51ab..e3726be 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -134,6 +134,7 @@ enum {
#define NVME_CAP_NSSRC(cap) (((cap) >> 36) & 0x1)
#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
#define NVME_CAP_MPSMAX(cap) (((cap) >> 52) & 0xf)
+#define NVME_CAP_CMBS(cap) (((cap) >> 57) & 0x1)
#define NVME_CMB_BIR(cmbloc) ((cmbloc) & 0x7)
#define NVME_CMB_OFST(cmbloc) (((cmbloc) >> 12) & 0xfffff)
--
1.8.3.1
next prev parent reply other threads:[~2020-06-23 13:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 13:24 [PATCH 0/3] Some improvements for NVMe Baolin Wang
2020-06-23 13:24 ` [PATCH 1/3] nvme: Add Arbitration Burst support Baolin Wang
2020-06-23 14:40 ` Keith Busch
2020-06-23 17:39 ` Sagi Grimberg
2020-06-23 18:01 ` Keith Busch
2020-06-24 1:34 ` Baolin Wang
2020-06-24 2:51 ` Keith Busch
2020-06-24 2:54 ` Baolin Wang
2020-06-24 2:57 ` Keith Busch
2020-06-24 3:06 ` Baolin Wang
2020-06-23 13:24 ` Baolin Wang [this message]
2020-06-23 16:27 ` [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro Christoph Hellwig
2020-06-24 2:07 ` Baolin Wang
2020-06-24 6:22 ` Baolin Wang
2020-06-24 2:58 ` Keith Busch
2020-06-24 5:47 ` Christoph Hellwig
2020-06-23 13:24 ` [PATCH 3/3] nvme: Use USEC_PER_SEC instead of magic numbers Baolin Wang
2020-06-23 17:39 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eab18c7696ea0e34a6ab0371d7d17ad45d1566ce.1592916850.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=axboe@fb.com \
--cc=baolin.wang7@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®