qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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: [PATCH V2 3/7] hw/block/nvme: fix allocated namespace list to 256
Date: Thu, 11 Feb 2021 01:09:33 +0900	[thread overview]
Message-ID: <20210210160937.1100-4-minwoo.im.dev@gmail.com> (raw)
In-Reply-To: <20210210160937.1100-1-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>
---
 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



  parent reply	other threads:[~2021-02-10 16:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 16:09 [PATCH V2 0/6] hw/block/nvme: support namespace attachment Minwoo Im
2021-02-10 16:09 ` [PATCH V2 1/7] hw/block/nvme: support namespace detach Minwoo Im
2021-02-10 16:09 ` [PATCH V2 2/7] hw/block/nvme: fix namespaces array to 1-based Minwoo Im
2021-02-10 16:09 ` Minwoo Im [this message]
2021-02-10 16:09 ` [PATCH V2 4/7] hw/block/nvme: support allocated namespace type Minwoo Im
2021-02-10 16:09 ` [PATCH V2 5/7] hw/block/nvme: refactor nvme_select_ns_iocs Minwoo Im
2021-02-10 16:09 ` [PATCH V2 6/7] hw/block/nvme: support namespace attachment command Minwoo Im
2021-02-22 20:43   ` Klaus Jensen
2021-02-26 17:59   ` Keith Busch
2021-02-27  1:01     ` Minwoo Im
2021-02-10 16:09 ` [PATCH V2 7/7] hw/block/nvme: support Identify NS Attached Controller List Minwoo Im
2021-02-22 20:53 ` [PATCH V2 0/6] hw/block/nvme: support namespace attachment Klaus Jensen
2021-02-26 13:14 ` 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=20210210160937.1100-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).