mirror_qemu/hw/core
Marcel Apfelbaum 4cae4d5aca hmp: fix regression of HMP device_del auto-completion
The commits:
 - 6a1fa9f5 (monitor: add del completion for peripheral device)
 - 66e56b13 (qdev: add qdev_build_hotpluggable_device_list helper)

cause a QEMU crash when trying to use HMP device_del auto-completion.
It can be easily reproduced by:
    <qemu-bin> -enable-kvm  ~/images/fedora.qcow2 -monitor stdio -device virtio-net-pci,id=vnet

    (qemu) device_del
    /home/mapfelba/git/upstream/qemu/hw/core/qdev.c:941:qdev_build_hotpluggable_device_list: Object 0x7f6ce04e4fe0 is not an instance of type device
    Aborted (core dumped)

The root cause is qdev_build_hotpluggable_device_list going recursively over
all peripherals and their children assuming all are devices. It doesn't work
since PCI devices have at least on child which is a memory region (bus master).

Solved by observing that all devices appear as direct children of
/machine/peripheral container. No need of going recursively
over all the children.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reported-by: Gal Hammer <ghammer@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 1417002601-20799-1-git-send-email-marcel.a@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-11-27 14:36:20 +00:00
..
Makefile.objs sysbus: Add new platform bus helper device 2014-11-04 23:26:14 +01:00
empty_slot.c empty_slot: QOM cast cleanup 2013-07-29 21:06:37 +02:00
fw-path-provider.c fw-path-provider: Change GPL version to 2+ 2014-04-07 15:36:07 +02:00
hotplug.c qdev: HotplugHandler: Provide unplug callback 2014-10-15 05:03:13 +02:00
irq.c irq: Remove qemu_irq_intercept_out 2014-10-23 16:41:25 +02:00
loader.c acpi-build: mark RAM dirty on table update 2014-11-24 20:57:10 +02:00
machine.c sysbus: Make devices spawnable via -device 2014-11-04 23:26:14 +01:00
nmi.c cpus: Define callback for QEMU "nmi" command 2014-08-25 13:25:16 +02:00
null-machine.c machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
platform-bus.c sysbus: Add new platform bus helper device 2014-11-04 23:26:14 +01:00
ptimer.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
qdev-properties-system.c hw: Convert from BlockDriverState to BlockBackend, mostly 2014-10-20 14:02:25 +02:00
qdev-properties.c hw: Convert from BlockDriverState to BlockBackend, mostly 2014-10-20 14:02:25 +02:00
qdev.c hmp: fix regression of HMP device_del auto-completion 2014-11-27 14:36:20 +00:00
stream.c stream: Remove app argument hack 2013-04-16 10:04:23 +02:00
sysbus.c sysbus: Expose MMIO enumeration helper 2014-11-04 23:26:14 +01:00
uboot_image.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00