All of lore.kernel.org
 help / color / mirror / Atom feed
From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH 1/6] nvme: display 'CMIC' controller attribute
Date: Mon,  2 Oct 2017 15:55:54 +0200	[thread overview]
Message-ID: <1506952559-1588-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1506952559-1588-1-git-send-email-hare@suse.de>

To figure out if a controller is multipath capable (ie if the
controller supports namespace sharing) we need to expose the CMIC
value to sysfs.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/core.c | 12 ++++++++++++
 drivers/nvme/host/nvme.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c296f27..b1e61c9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2061,6 +2061,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	atomic_set(&ctrl->abort_limit, id->acl + 1);
 	ctrl->vwc = id->vwc;
 	ctrl->cntlid = le16_to_cpup(&id->cntlid);
+	ctrl->cmic = id->cmic;
 	if (id->mdts)
 		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
 	else
@@ -2486,6 +2487,16 @@ static ssize_t nvme_sysfs_show_address(struct device *dev,
 }
 static DEVICE_ATTR(address, S_IRUGO, nvme_sysfs_show_address, NULL);
 
+static ssize_t nvme_sysfs_show_cmic(struct device *dev,
+				    struct device_attribute *attr,
+				    char *buf)
+{
+	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", ctrl->cmic);
+}
+static DEVICE_ATTR(cmic, S_IRUGO, nvme_sysfs_show_cmic, NULL);
+
 static struct attribute *nvme_dev_attrs[] = {
 	&dev_attr_reset_controller.attr,
 	&dev_attr_rescan_controller.attr,
@@ -2498,6 +2509,7 @@ static ssize_t nvme_sysfs_show_address(struct device *dev,
 	&dev_attr_subsysnqn.attr,
 	&dev_attr_address.attr,
 	&dev_attr_state.attr,
+	&dev_attr_cmic.attr,
 	NULL
 };
 
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index febc21d..10fffbc 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -170,6 +170,7 @@ struct nvme_ctrl {
 	u16 kas;
 	u8 npss;
 	u8 apsta;
+	u8 cmic;
 	unsigned int shutdown_timeout;
 	unsigned int kato;
 	bool subsystem;
-- 
1.8.5.6

  reply	other threads:[~2017-10-02 13:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 13:55 [PATCH 0/6] nvme: sanitize multipathing Hannes Reinecke
2017-10-02 13:55 ` Hannes Reinecke [this message]
2017-10-02 16:15   ` [PATCH 1/6] nvme: display 'CMIC' controller attribute Christoph Hellwig
2017-10-02 13:55 ` [PATCH 2/6] nvme: use 'nvmsXnZ' instead of 'nvm-subXnZ' Hannes Reinecke
2017-10-02 16:16   ` Christoph Hellwig
2017-10-02 16:20     ` Keith Busch
2017-10-11 14:32       ` Guan Junxiong
2017-10-02 13:55 ` [PATCH 3/6] nvme: claim block devices Hannes Reinecke
2017-10-02 16:42   ` Christoph Hellwig
2017-10-03 10:08     ` Hannes Reinecke
2017-10-03 11:55       ` Christoph Hellwig
2017-10-04  5:42         ` Hannes Reinecke
2017-10-04  6:15           ` Christoph Hellwig
2017-10-04  6:33             ` Hannes Reinecke
2017-10-04  7:13               ` Christoph Hellwig
2017-10-04  7:26                 ` Hannes Reinecke
2017-10-05  1:08                 ` Martin K. Petersen
2017-10-05  6:51                   ` Johannes Thumshirn
2017-10-05 14:05                     ` Keith Busch
2017-10-05 14:39                       ` Hannes Reinecke
2017-10-05 14:47                         ` Christoph Hellwig
2017-10-02 13:55 ` [PATCH 4/6] nvme: display 'NMIC' namespace attribute Hannes Reinecke
2017-10-02 16:16   ` Christoph Hellwig
2017-10-03 10:00     ` Hannes Reinecke
2017-10-03 11:49       ` Christoph Hellwig
2017-10-03 16:01         ` Hannes Reinecke
2017-10-02 13:55 ` [PATCH 5/6] nvme: Export subsystems to /sys/class/nvme-subsys Hannes Reinecke
2017-10-02 16:18   ` Christoph Hellwig
2017-10-02 16:53     ` Keith Busch
2017-10-02 16:56       ` Christoph Hellwig
2017-10-02 17:15         ` Keith Busch
2017-10-02 13:55 ` [PATCH 6/6] nvme: ignore retries for multipath devices Hannes Reinecke
2017-10-02 16:22   ` Christoph Hellwig
2017-10-03 10:02     ` Hannes Reinecke
2017-10-03 11:53       ` Christoph Hellwig
2017-10-02 14:35 ` [PATCH] nvme: reset retires after path failover Johannes Thumshirn
2017-10-02 14:43   ` Keith Busch
2017-10-02 15:08     ` Hannes Reinecke
2017-10-02 14:45   ` Johannes Thumshirn
2017-10-02 16:25     ` Christoph Hellwig
2017-10-02 14:46   ` Johannes Thumshirn
2017-10-02 16:19   ` Christoph Hellwig

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=1506952559-1588-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.