Markus Armbruster <arm...@redhat.com> writes: [...] > qdev_device_add() looks like a bus-less device is usable if the machine > provides a hotplug handler for it. Commit 03fcbd9dc5 "qdev: Check for > the availability of a hotplug controller before adding a device" seems > to be pertinent.
Nope. A hotplug handler is only required for hot plug (d'oh!), not for cold plug. I wonder whether bus-less devices should default to .user_creatable = false like sysbus devices, and for the same reasons. To actually *do* something, a physical device requires some connection to the rest of the world. Same for a virtual device (at least the ones that model physical devices). sysbus_device_class_init(): /* * device_add plugs devices into a suitable bus. For "real" buses, * that actually connects the device. For sysbus, the connections * need to be made separately, and device_add can't do that. The * device would be left unconnected, and will probably not work * * However, a few machines can handle device_add/-device with * a few specific sysbus devices. In those cases, the device * subclass needs to override it and set user_creatable=true. */ k->user_creatable = false; The reasoning applies to bus-less devices just as well, doesn't it? [...]