[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] hw/block/nvme: fix allocated namespace list to 256
From: |
Minwoo Im |
Subject: |
[PATCH 3/6] hw/block/nvme: fix allocated namespace list to 256 |
Date: |
Sat, 6 Feb 2021 12:36:26 +0900 |
Expand allocated namespace list (subsys->namespaces) to have 256 entries
which is a value lager than at least NVME_MAX_NAMESPACES which is for
attached namespace list in a controller.
Allocated namespace list should at least larger than attached namespace
list.
n->num_namespaces = NVME_MAX_NAMESPACES;
The above line will set the NN field by id->nn so that the subsystem
should also prepare at least this number of namespace list entries.
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
---
hw/block/nvme-subsys.h | 2 +-
hw/block/nvme.h | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h
index 574774390c4c..8a0732b22316 100644
--- a/hw/block/nvme-subsys.h
+++ b/hw/block/nvme-subsys.h
@@ -14,7 +14,7 @@
OBJECT_CHECK(NvmeSubsystem, (obj), TYPE_NVME_SUBSYS)
#define NVME_SUBSYS_MAX_CTRLS 32
-#define NVME_SUBSYS_MAX_NAMESPACES 32
+#define NVME_SUBSYS_MAX_NAMESPACES 256
typedef struct NvmeCtrl NvmeCtrl;
typedef struct NvmeNamespace NvmeNamespace;
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index bde0ed7c2679..1c7796b20996 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -10,6 +10,12 @@
#define NVME_DEFAULT_ZONE_SIZE (128 * MiB)
#define NVME_DEFAULT_MAX_ZA_SIZE (128 * KiB)
+/*
+ * Subsystem namespace list for allocated namespaces should be larger than
+ * attached namespace list in a controller.
+ */
+QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_SUBSYS_MAX_NAMESPACES);
+
typedef struct NvmeParams {
char *serial;
uint32_t num_queues; /* deprecated since 5.1 */
--
2.17.1
- [PATCH 0/6] hw/block/nvme: support namespace attachment, Minwoo Im, 2021/02/05
- [PATCH 1/6] hw/block/nvme: support namespace detach, Minwoo Im, 2021/02/05
- [PATCH 2/6] hw/block/nvme: fix namespaces array to 1-based, Minwoo Im, 2021/02/05
- [PATCH 3/6] hw/block/nvme: fix allocated namespace list to 256,
Minwoo Im <=
- [PATCH 4/6] hw/block/nvme: support allocated namespace type, Minwoo Im, 2021/02/05
- [PATCH 5/6] hw/block/nvme: refactor nvme_select_ns_iocs, Minwoo Im, 2021/02/05
- [PATCH 6/6] hw/block/nvme: support namespace attachment command, Minwoo Im, 2021/02/05