[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 1/5] hw/block/nvme: add controller id parameter
From: |
Minwoo Im |
Subject: |
[RFC PATCH 1/5] hw/block/nvme: add controller id parameter |
Date: |
Fri, 15 Jan 2021 21:05:54 +0900 |
There is Contrller ID field in Identify Controller data structure and
nvme device has never set this field, 0 by default.
Added a parameter for controller identifier in a NVM subsystem. This is
reflected to Identify Controller data structrue of the controller. This
parameter is helpful when a user wants to set up multi-controller in a
NVM subsystem.
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 cf0fe28fe6eb..132e61c0ee7b 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -23,6 +23,7 @@
* max_ioqpairs=<N[optional]>, \
* aerl=<N[optional]>, aer_max_queued=<N[optional]>, \
* mdts=<N[optional]>,zoned.append_size_limit=<N[optional]> \
+ * cntlid=<N[optional]>
* -device nvme-ns,drive=<drive_id>,bus=<bus_name>,nsid=<nsid>,\
* zoned=<true|false[optional]>
*
@@ -50,6 +51,12 @@
* completion when there are no outstanding AERs. When the maximum number of
* enqueued events are reached, subsequent events will be dropped.
*
+ * - `cntlid`
+ * NVM subsystem unique controller identifier (default: 0). This property
+ * is used if a user wants to set up multi-controller in a NVM subsystem.
+ * This value will be reported through Identify Controller data structure
+ * with a field named CNTLID[79:78].
+ *
* - `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
@@ -4275,6 +4282,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice
*pci_dev)
n->bar.vs = NVME_SPEC_VER;
n->bar.intmc = n->bar.intms = 0;
+
+ id->cntlid = n->params.cntlid;
}
static void nvme_realize(PCIDevice *pci_dev, Error **errp)
@@ -4345,6 +4354,7 @@ static Property nvme_props[] = {
DEFINE_BLOCK_PROPERTIES(NvmeCtrl, namespace.blkconf),
DEFINE_PROP_LINK("pmrdev", NvmeCtrl, pmrdev, TYPE_MEMORY_BACKEND,
HostMemoryBackend *),
+ DEFINE_PROP_UINT32("cntlid", NvmeCtrl, params.cntlid, 0),
DEFINE_PROP_STRING("serial", NvmeCtrl, params.serial),
DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0),
DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 0),
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index b7fbcca39d9f..6aa9e89ac5a8 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -11,6 +11,7 @@
typedef struct NvmeParams {
char *serial;
+ uint32_t cntlid;
uint32_t num_queues; /* deprecated since 5.1 */
uint32_t max_ioqpairs;
uint16_t msix_qsize;
--
2.17.1
- [RFC PATCH 0/5] hw/block/nvme: support multi-path for ctrl/ns, Minwoo Im, 2021/01/15
- [RFC PATCH 1/5] hw/block/nvme: add controller id parameter,
Minwoo Im <=
- [RFC PATCH 3/5] hw/block/nvme: add multi-controller param for mpath, Minwoo Im, 2021/01/15
- [RFC PATCH 2/5] nvme: add CMIC enum value for Identify Controller, Minwoo Im, 2021/01/15
- [RFC PATCH 4/5] nvme: add NMIC enum value for Identify Namespace, Minwoo Im, 2021/01/15
- [RFC PATCH 5/5] hw/block/nvme: add namespace sharing param for mpath, Minwoo Im, 2021/01/15
- Re: [RFC PATCH 0/5] hw/block/nvme: support multi-path for ctrl/ns, Klaus Jensen, 2021/01/15