On 5/11/21 3:37 PM, Klaus Jensen wrote:
On May 11 15:12, Hannes Reinecke wrote:
On 5/11/21 2:22 PM, Klaus Jensen wrote:
[ .. ]
The hotplug fix looks good - I'll post a series that tries to integrate
both.
Ta.
The more I think about it, the more I think we should be looking into
reparenting the namespaces to the subsystem.
That would have the _immediate_ benefit that 'device_del' and
'device_add' becomes symmetric (ie one doesn't have to do a separate
'device_add nvme-ns'), as the nvme namespace is not affected by the
hotplug event.
I have that working, but I'm struggling with a QEMU API technicality in
that I apparently cannot simply move the NvmeBus creation to the
nvme-subsys device. For some reason the bus is not available for the
nvme-ns devices. That is, if one does something like this:
-device nvme-subsys,...
-device nvme-ns,...
Then I get an error that "no 'nvme-bus' bus found for device 'nvme'ns".
This is probably just me not grok'ing the qdev well enough, so I'll keep
trying to fix that. What works now is to have the regular setup:
_Normally_ the 'id' of the parent device spans a bus, so the syntax
should be
-device nvme-subsys,id=subsys1,...
-device nvme-ns,bus=subsys1,...
-device nvme-subsys,...
-device nvme,...
-device nvme-ns,...
And the nvme-ns device will then reparent to the NvmeBus on nvme-subsys
(which magically now IS available when nvme-ns is realized). This has
the same end result, but I really would like that the namespaces could
be specified as children of the subsys directly.
Shudder.
Automatic reparenting.
To my understanding from qdev that shouldn't even be possible.
Please don't.