qemu-e2k/include/hw
Thomas Huth 03fcbd9dc5 qdev: Check for the availability of a hotplug controller before adding a device
The qdev_unplug() function contains a g_assert(hotplug_ctrl) statement,
so QEMU crashes when the user tries to device_add + device_del a device
that does not have a corresponding hotplug controller. This could be
provoked for a couple of devices in the past (see commit 4c93950659
or 84ebd3e8c7 for example), and can currently for example also be
triggered like this:

$ s390x-softmmu/qemu-system-s390x -M none -nographic
QEMU 2.10.50 monitor - type 'help' for more information
(qemu) device_add qemu-s390x-cpu,id=x
(qemu) device_del x
**
ERROR:qemu/qdev-monitor.c:872:qdev_unplug: assertion failed: (hotplug_ctrl)
Aborted (core dumped)

So devices clearly need a hotplug controller when they should be usable
with device_add.
The code in qdev_device_add() already checks whether the bus has a proper
hotplug controller, but for devices that do not have a corresponding bus,
there is no appropriate check available yet. In that case we should check
whether the machine itself provides a suitable hotplug controller and
refuse to plug the device if none is available.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1509617407-21191-3-git-send-email-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2018-01-19 11:18:51 -02:00
..
acpi acpi: Update TPM2 ACPI table to more recent specs 2017-12-22 11:03:21 -05:00
adc
arm imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file 2018-01-11 13:25:38 +00:00
audio
block hw/block: Fix the return type 2017-12-19 09:25:28 +00:00
char hw/char/cmsdk-apb-uart.c: Implement CMSDK APB UART 2017-07-17 13:36:08 +01:00
core
cpu hw: remove "qemu/osdep.h" from header files 2017-12-18 17:07:02 +03:00
cris
display hw/display/vga: extract public API from i386/pc to "hw/display/vga.h" 2017-12-18 17:07:02 +03:00
dma
gpio
i2c ppc4xx_i2c: Implement basic I2C functions 2018-01-10 12:52:59 +11:00
i386 intel-iommu: Extend address width to 48 bits 2018-01-18 21:52:38 +02:00
ide ide: support reporting of rotation rate 2017-10-12 12:10:37 +02:00
input
intc nvic: Make systick banked 2017-12-13 17:59:26 +00:00
ipack
ipmi
isa i8259: generalize statistics into common code 2017-12-21 09:30:32 +01:00
kvm
lm32
m68k
mem qmp: introduce query-memory-size-summary command 2017-09-14 15:52:10 +01:00
mips mips: malta/boston: replace cpu_model with cpu_type 2017-10-27 16:04:28 +02:00
misc hw/misc/pvpanic: extract public API from i386/pc to "hw/misc/pvpanic.h" 2017-12-18 17:07:02 +03:00
net imx_fec: Reserve full FSL_IMX25_FEC_SIZE page for the register file 2018-01-11 13:25:38 +00:00
nvram fw_cfg: add write callback 2017-10-15 05:54:40 +03:00
pci pci: Eliminate pci_find_primary_bus() 2017-12-05 19:13:45 +02:00
pci-host Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
ppc ppc/pnv: fix XSCOM core addressing on POWER9 2018-01-17 09:35:24 +11:00
s390x s390x/css: unrestrict cssids 2017-12-14 17:56:54 +01:00
scsi esp: move TYPE_ESP and SysBusESPState from esp.c to esp.h 2017-10-31 17:25:36 +00:00
sd sdhci: add a 'dma' property to the sysbus devices 2018-01-16 13:28:21 +00:00
sh4
smbios smbios: support setting OEM strings table 2017-12-05 19:13:45 +02:00
sparc sun4u_iommu: update to reflect IOMMU is no longer part of the APB device 2018-01-09 21:48:20 +00:00
ssi xilinx_spips: Set all of the reset values 2017-12-13 17:59:26 +00:00
timer hw/timer/mc146818: rename rtc_init() -> mc146818_rtc_init() 2017-12-18 17:07:02 +03:00
tricore
unicore32 hw/unicore32: restrict hw addr defines to source file 2017-12-18 17:07:02 +03:00
usb
vfio
virtio vhost-user-blk: introduce a new vhost-user-blk host device 2018-01-18 21:52:37 +02:00
watchdog watchdog: wdt_aspeed: Add support for the reset width register 2017-09-04 15:21:54 +01:00
xen pci: Add pci_dev_bus_num() helper 2017-12-05 19:13:45 +02:00
xtensa target/xtensa: import libisa source 2017-12-18 21:26:19 -08:00
boards.h machine: Replace has_dynamic_sysbus with list of allowed devices 2018-01-19 11:18:51 -02:00
bt.h
compat.h hpet: recover timer offset correctly 2018-01-12 13:22:02 +01:00
devices.h
elf_ops.h loader: Ignore zero-sized ELF segments 2017-09-04 15:21:53 +01:00
empty_slot.h
fw-path-provider.h
hotplug.h
hw.h
ide.h
irq.h
loader-fit.h
loader.h fw_cfg: rename read callback 2017-09-08 16:15:17 +03:00
nmi.h
or-irq.h include/hw/or-irq.h: Drop unused in_irqs field 2017-10-16 21:09:15 +03:00
pcmcia.h
platform-bus.h
ptimer.h
qdev-core.h qdev: Check for the availability of a hotplug controller before adding a device 2018-01-19 11:18:51 -02:00
qdev-dma.h
qdev-properties.h Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
qdev.h
register.h
registerfields.h hw/registerfields: add missing include 2017-12-18 17:07:02 +03:00
stream.h
sysbus.h
usb.h hmp-commands: Remove the deprecated usb_add and usb_del 2017-12-14 10:16:52 +00:00