From: Minwoo Im <minwoo.im.dev@gmail.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>,
Minwoo Im <minwoo.im.dev@gmail.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: [RFC PATCH 3/5] hw/block/nvme: add multi-controller param for mpath
Date: Fri, 15 Jan 2021 21:05:56 +0900 [thread overview]
Message-ID: <20210115120558.29313-4-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20210115120558.29313-1-minwoo.im.dev@gmail.com>
Added mpath.ctrl parameter to set multi-controller bit[1] in CMIC field
in Identify Controller data structure. It will indicate that a NVM
subsystem can have two or more controllers in the subsystem.
To set up multi-controller in a NVM subsystem, user needs to give same
serial parameter to the controllers (-device), but different cntlid
parameter to each controllers (-device).
Example:
-device nvme,ctrlid=0,serial=foo,...
-device nvme,ctrlid=1,serial=foo,...
The example above prepares two different controllers in a NVM subsystem
with the same serial which leads to same subsystem NQN.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
---
hw/block/nvme.c | 10 ++++++++++
hw/block/nvme.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 132e61c0ee7b..50b349cf9ea3 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -57,6 +57,11 @@
* This value will be reported through Identify Controller data structure
* with a field named CNTLID[79:78].
*
+ * - `mpath.ctrl`
+ * Multi-path I/O with multi-controller (default: false). A NVM subsystem
+ * can hold two or more controllers. This will be reflected to Identify
+ * Controller data structure CMIC[76] field.
+ *
* - `zoned.append_size_limit`
* The maximum I/O size in bytes that is allowed in Zone Append command.
* The default is 128KiB. Since internally this this value is maintained as
@@ -4284,6 +4289,10 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
n->bar.intmc = n->bar.intms = 0;
id->cntlid = n->params.cntlid;
+
+ if (n->params.mpath_ctrl) {
+ id->cmic |= NVME_CMIC_MULTI_CTRL;
+ }
}
static void nvme_realize(PCIDevice *pci_dev, Error **errp)
@@ -4364,6 +4373,7 @@ static Property nvme_props[] = {
DEFINE_PROP_UINT32("aer_max_queued", NvmeCtrl, params.aer_max_queued, 64),
DEFINE_PROP_UINT8("mdts", NvmeCtrl, params.mdts, 7),
DEFINE_PROP_BOOL("use-intel-id", NvmeCtrl, params.use_intel_id, false),
+ DEFINE_PROP_BOOL("mpath.ctrl", NvmeCtrl, params.mpath_ctrl, false),
DEFINE_PROP_SIZE32("zoned.append_size_limit", NvmeCtrl, params.zasl_bs,
NVME_DEFAULT_MAX_ZA_SIZE),
DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index 6aa9e89ac5a8..73c9c2cff247 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -21,6 +21,7 @@ typedef struct NvmeParams {
uint8_t mdts;
bool use_intel_id;
uint32_t zasl_bs;
+ bool mpath_ctrl;
} NvmeParams;
typedef struct NvmeAsyncEvent {
--
2.17.1
next prev parent reply other threads:[~2021-01-15 12:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 12:05 [RFC PATCH 0/5] hw/block/nvme: support multi-path for ctrl/ns Minwoo Im
2021-01-15 12:05 ` [RFC PATCH 1/5] hw/block/nvme: add controller id parameter Minwoo Im
2021-01-15 12:05 ` [RFC PATCH 2/5] nvme: add CMIC enum value for Identify Controller Minwoo Im
2021-01-15 12:05 ` Minwoo Im [this message]
2021-01-15 12:05 ` [RFC PATCH 4/5] nvme: add NMIC enum value for Identify Namespace Minwoo Im
2021-01-15 12:05 ` [RFC PATCH 5/5] hw/block/nvme: add namespace sharing param for mpath Minwoo Im
2021-01-15 13:57 ` [RFC PATCH 0/5] hw/block/nvme: support multi-path for ctrl/ns Klaus Jensen
2021-01-15 17:35 ` Keith Busch
2021-01-15 17:47 ` Klaus Jensen
2021-01-15 17:53 ` Keith Busch
2021-01-15 18:38 ` Minwoo Im
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=20210115120558.29313-4-minwoo.im.dev@gmail.com \
--to=minwoo.im.dev@gmail.com \
--cc=its@irrelevant.dk \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).