On Jun 27 18:34, Niklas Cassel wrote: > 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
I don't have a problem with this. Wanna send the patch?
signature.asc
Description: PGP signature