qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nvme shared namespaces without subsys


From: Niklas Cassel
Subject: nvme shared namespaces without subsys
Date: Mon, 27 Jun 2022 18:34:06 +0000

Hello qemu-nvme maintainers,

I noticed that since commit
916b0f0b5264 ("hw/nvme: change nvme-ns 'shared' default")

The default value of ns param 'shared' is true, regardless
if there is a nvme-subsys node or not.

It probably doesn't matter that the NMIC bit gets set when
there is no nvme-subsys node, as there is no requirement
that such a namespace is attached to more than one controller,
even when it can be.

However, it does seem a bit awkward to have the bit set by
default when it is impossible for such a namespace to be
attached to more than one controller without a nvme-subsys
node.

What do you think about something like:

diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 1b9c9d1156..4bf20ec836 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -546,6 +546,8 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp)
     int i;
 
     if (!n->subsys) {
+        /* If no subsys, the ns cannot be attached to more than one ctrl. */
+        ns->params.shared = false;
         if (ns->params.detached) {
             error_setg(errp, "detached requires that the nvme device is "
                        "linked to an nvme-subsys device");



The downside with this proposal is that even though we
might not want NMIC to be set by default when we don't
have a nvme-subsys node, we might still want to be able
to explictly set it for testing purposes.


Kind regards,
Niklas


reply via email to

[Prev in Thread] Current Thread [Next in Thread]