On Mon, Sep 25, 2017 at 07:42:13PM +0200, Thomas Huth wrote: > On 25.09.2017 17:26, Peter Maydell wrote: > > On 25 September 2017 at 16:19, Thomas Huth <th...@redhat.com> wrote: > >> Not sure whether this works for the virtio-xxx-device devices, > >> though, since they are marked as user_creatable = true currently... > > > > That's deliberate -- for the arm boards with virtio-mmio > > the board creates a bunch of virtio-mmio transports and the > > virtio-foo-device can be user created to plug into those. > > Yes, I know ... I'm just wondering whether the virtio-xxx-device devices > should be non-user_creatable on the non-ARM targets, since they > apparently can't be used with "-device" there...?
I wouldn't like to make DeviceClass fields depend on the target. Being user-creatable doesn't mean they will work on all machines, anyway. If user/management need more specific info, they need something like the query-device-slots command I've proposed some time ago. > > > If overall trying to do the 'right thing' is tricky here > > then perhaps we can start by flipping the default to > > not-hotpluggable and marking some devices hotpluggable > > that in theory shouldn't be with a comment about why. > > Yes, if Eduardo's idea to move the test to qmp_device_add() does not > work out (I'll try that next), your suggestion is certainly the best > thing we can do right now. I think it would work, but we would lose the feature Peter mentions below: > > > Incidentally I think there's still some advantage in the > > "created as part of some other device" devices having > > to be explicitly marked hotpluggable, because those > > devices do still need some specific code in them to > > handle it (ie code to release the resources that are > > created in the device's realize method). > > Ok ... by the way, does anybody know more devices like > virtio-xxx-device, i.e. devices that are indirectly plugged when adding > other devices? "make check" found a few candidates: https://travis-ci.org/ehabkost/qemu/jobs/278743999 Initialization of device dpcd failed: Device 'dpcd' does not support hotplugging [...] Initialization of device nand failed: Device 'nand' does not support hotplugging Finding the full list of devices that can be instantiated internally at hotplug-time sounds tricky. -- Eduardo