On Wed, 13 Jul 2022 at 09:49, Bernhard Beschow <shen...@gmail.com> wrote: > > The USB controller is an integral part of PIIX3 (function 2). So create > it as part of the southbridge. > > Note that the USB function is optional in QEMU. This is why it gets > unparented if it is disabled, otherwiese QEMU will abort with: > > src/hw/core/qdev.c:357: qdev_assert_realized_properly_cb: Assertion > `dev->realized' failed
I would suggest doing the object_initialize_child() in realize when we know whether usb is enabled or not, rather than always initializing it and then unparenting it later. That's the way I've handled "some property value determines whether or not the device has a child object" in other places. thanks -- PMM