[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 33/38] hw/block/nvme: fix allocated namespace list to 256
From: |
Klaus Jensen |
Subject: |
[PULL v2 33/38] hw/block/nvme: fix allocated namespace list to 256 |
Date: |
Tue, 9 Mar 2021 12:45:07 +0100 |
From: Minwoo Im <minwoo.im.dev@gmail.com>
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>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Tested-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.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 20d34004c677..65a8bcda030d 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 cd8d40634411..85a7b5a14f4e 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.30.1
- [PULL v2 23/38] hw/block/nvme: add trace event for zone read check, (continued)
- [PULL v2 23/38] hw/block/nvme: add trace event for zone read check, Klaus Jensen, 2021/03/09
- [PULL v2 26/38] hw/block/nvme: remove block accounting for write zeroes, Klaus Jensen, 2021/03/09
- [PULL v2 25/38] hw/block/nvme: remove redundant len member in compare context, Klaus Jensen, 2021/03/09
- [PULL v2 31/38] hw/block/nvme: support namespace detach, Klaus Jensen, 2021/03/09
- [PULL v2 27/38] hw/block/nvme: fix strerror printing, Klaus Jensen, 2021/03/09
- [PULL v2 35/38] hw/block/nvme: refactor nvme_select_ns_iocs, Klaus Jensen, 2021/03/09
- [PULL v2 32/38] hw/block/nvme: fix namespaces array to 1-based, Klaus Jensen, 2021/03/09
- [PULL v2 36/38] hw/block/nvme: support namespace attachment command, Klaus Jensen, 2021/03/09
- [PULL v2 37/38] hw/block/nvme: support changed namespace asynchronous event, Klaus Jensen, 2021/03/09
- [PULL v2 38/38] hw/block/nvme: support Identify NS Attached Controller List, Klaus Jensen, 2021/03/09
- [PULL v2 33/38] hw/block/nvme: fix allocated namespace list to 256,
Klaus Jensen <=
- [PULL v2 34/38] hw/block/nvme: support allocated namespace type, Klaus Jensen, 2021/03/09
- Re: [PULL v2 00/38] emulated nvme device updates, Peter Maydell, 2021/03/11