summaryrefslogtreecommitdiffstats
path: root/hw/block/nvme.h
diff options
context:
space:
mode:
authorMinwoo Im2021-02-05 18:09:20 +0100
committerKlaus Jensen2021-03-09 11:00:58 +0100
commit92cad003c131c1866580beb4c00e19551652be8d (patch)
treec429c795accdedbe063b22b3bd9242c7a574b80a /hw/block/nvme.h
parenthw/block/nvme: fix namespaces array to 1-based (diff)
downloadqemu-92cad003c131c1866580beb4c00e19551652be8d.tar.gz
qemu-92cad003c131c1866580beb4c00e19551652be8d.tar.xz
qemu-92cad003c131c1866580beb4c00e19551652be8d.zip
hw/block/nvme: fix allocated namespace list to 256
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>
Diffstat (limited to 'hw/block/nvme.h')
-rw-r--r--hw/block/nvme.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index cd8d406344..85a7b5a14f 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 */