summary refs log tree commit diff stats
path: root/hw/nvme/subsys.c
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2025-04-08 12:20:46 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-04-08 20:46:10 +0200
commit8c996e32712820d6d1e62ba6436424d0ba837d96 (patch)
treee2133cc3dcd1f6617e26c08b06ffc895851a0c5c /hw/nvme/subsys.c
parentf978f410aa4f4b5ce9a4c18c815507bcbfb75b9d (diff)
downloadfocaccia-qemu-8c996e32712820d6d1e62ba6436424d0ba837d96.tar.gz
focaccia-qemu-8c996e32712820d6d1e62ba6436424d0ba837d96.zip
hw/nvme: fix attachment of private namespaces
Fix regression when attaching private namespaces that gets attached to
the wrong controller.

Keep track of the original controller "owner" of private namespaces, and
only attach if this matches on controller enablement.

Fixes: 6ccca4b6bb9f ("hw/nvme: rework csi handling")
Reported-by: Alan Adamson <alan.adamson@oracle.com>
Suggested-by: Alan Adamson <alan.adamson@oracle.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Tested-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Message-ID: <20250408-fix-private-ns-v1-1-28e169b6b60b@samsung.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/nvme/subsys.c')
-rw-r--r--hw/nvme/subsys.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c
index 2ae56f12a5..b617ac3892 100644
--- a/hw/nvme/subsys.c
+++ b/hw/nvme/subsys.c
@@ -56,7 +56,7 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
 {
     NvmeSubsystem *subsys = n->subsys;
     NvmeSecCtrlEntry *sctrl = nvme_sctrl(n);
-    int cntlid, nsid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
+    int cntlid, num_rsvd, num_vfs = n->params.sriov_max_vfs;
 
     if (pci_is_vf(&n->parent_obj)) {
         cntlid = le16_to_cpu(sctrl->scid);
@@ -92,13 +92,6 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
 
     subsys->ctrls[cntlid] = n;
 
-    for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) {
-        NvmeNamespace *ns = subsys->namespaces[nsid];
-        if (ns && ns->params.shared && !ns->params.detached) {
-            nvme_attach_ns(n, ns);
-        }
-    }
-
     return cntlid;
 }