From: Markus Armbruster <arm...@redhat.com> In an ideal world, machines can be built by wiring devices together with configuration, not code. Unfortunately, that's not the world we live in right now. We still have quite a few devices that need to be wired up by code. If you try to device_add such a device, it'll fail in sometimes mysterious ways. If you're lucky, you get an unmysterious immediate crash.
We used to protect users from such badness by marking devices where device_add cannot possibly work "no-user", and refusing to device_add them. Anthony silently broke the protection in v1.1. He has rejected attempts to unbreak it with the argument that the protection makes it impossible to wire devices together with configuration, not code, and that the protection is being misused[*]. On the former, I disagree. The problem isn't protecting users from devices that cannot be wired up that way, it's devices that cannot be wired up that way. On the latter, Anthony has a point: the purpose of the no-user flag isn't obvious, and some of its uses are suspect. So, instead of just fixing the regression, this series first addresses that point. PATCH 1 clarifies the purpose of no-user. PATCH 2-9 clean up and document its use. PATCH 10 fixes the regression. The series makes following devices available with device_add: * PCI [PATCH 07-08]: piix3-ide, piix3-ide-xen, piix4-ide, via-ide * ISA [PATCH 09]: i8042, isa-fdc The following devices are made unavailable: * PCI [PATCH 05]: dec-21154, e500-host-bridge, gt64120_pci, mch, pbm-pci, ppc4xx-host-bridge, sh_pci_host, u3-agp, uni-north-agp, uni-north-internal-pci, uni-north-pci, versatile_pci_host * Sysbus [PATCH 02]: ARM,bitband-memory, SUNW,CS4231, SUNW,fdtwo, SUNW,tcx, a15mpcore_priv, a9-scu, a9mpcore_priv, apc, arm11mpcore_priv, cadence_gem, cadence_ttc, cadence_uart, cfi.pflash01, cfi.pflash02, cuda, dec-21154-sysbus, ds1225y, e500-ccsr, e500-pcihost, e500-spin, eccmemctl, empty_slot, escc, esp, etraxfs,pic, etraxfs,serial, etraxfs,timer, etraxfs-eth, exynos4210-ehci-usb, exynos4210.combiner, exynos4210.fimd, exynos4210.gic, exynos4210.i2c, exynos4210.irq_gate, exynos4210.mct, exynos4210.pmu, exynos4210.pwm, exynos4210.rtc, exynos4210.uart, fusbh200-ehci-usb, generic-sdhci, gpio_i2c, grlib,apbuart, grlib,gptimer, grlib,irqmp, gt64120, highbank-regs, icc-bridge, imx-serial, imx.epit, imx.gpt, imx_avic, imx_ccm, integrator_core, integrator_pic, integrator_pit, iommu, jazz-led, lan9118, lance, lm32-juart, lm32-pic, lm32-sys, lm32-timer, lm32-uart, m48t59, macio-ide, macio-nvram, macio_idreg, mainstone-fpga, memory, milkymist-ac97, milkymist-hpdmc, milkymist-memcard, milkymist-minimac2, milkymist-pfpu, milkymist-softusb, milkymist-sysctl, milkymist-tmu2, milkymist-uart, milkymist-vgafb, mips-malta, mipsnet, mmio-ide, mpc8544-guts, musicpal-misc, musicpal_gpio, musicpal_key, musicpal_lcd, mv88w8618_audio, mv88w8618_eth, mv88w8618_flashcfg, mv88w8618_pic, mv88w8618_pit, mv88w8618_wlan, omap-gpio, omap-intc, omap2-gpio, omap2-intc, omap_i2c, onenand, open_eth, openpic, openprom, pbm, pl011, pl011_luminary, pl022, pl050_keyboard, pl050_mouse, pl061, pl061_luminary, pl330, ppc4xx-pcihost, puv3_dma, puv3_gpio, puv3_intc, puv3_ost, puv3_pm, pxa25x-timer, pxa27x-timer, pxa2xx-dma, pxa2xx-gpio, pxa2xx-ssp, pxa2xx_i2c, pxa2xx_pic, pxa2xx_rtc, q35-pcihost, realview_gic, realview_mpcore, realview_pci, realview_sysctl, s390-sclp-event-facility, scoop, sh_pci, sl-nand, slavio_intctl, slavio_misc, slavio_timer, smc91c111, sp804, spapr-pci-host-bridge, sparc32_dma, spitz-keyboard, stellaris-adc, stellaris-gptm, stellaris-i2c, stellaris_enet, strongarm-gpio, strongarm-ppc, strongarm-rtc, strongarm-ssp, strongarm-uart, strongarm_pic, sysbus-ahci, sysbus-fdc, sysbus-g364, sysbus-ohci, tcx_afx, tegra2-ehci-usb, tusb6010, u3-agp-pcihost, uni-north-agp-pcihost, uni-north-internal-pci-pcihost, uni-north-pci-pcihost, versatile_i2c, versatile_pci, virtio-mmio, xgmac, xics, xilinx,zynq_slcr, xlnx,ps7-usb, xlnx.axi-dma, xlnx.ps7-qspi, xlnx.ps7-spi, xlnx.xps-ethernetlite, xlnx.xps-intc, xlnx.xps-spi, xlnx.xps-timer, xlnx.xps-uartlite v4: straightforward rebase (only PATCH 10/10 conflicts) v3: address Eric Blake's and Marcel Apfelbaum's review * Clean up a harmless editing accident in PATCH 07 * Simplify PATCH 10 slightly v2: address Peter Maydell's review * Some commit messages improved * Use QOM cast macros instead of .parent_class [PATCH 05] * keep cannot_instantiate_with_device_add_yet for port92, isa-pit, kvm-pit, m48t59_isa, mc146818rtc [PATCH 09] Markus Armbruster (10): qdev: Replace no_user by cannot_instantiate_with_device_add_yet sysbus: Set cannot_instantiate_with_device_add_yet cpu: Document why cannot_instantiate_with_device_add_yet apic: Document why cannot_instantiate_with_device_add_yet pci-host: Consistently set cannot_instantiate_with_device_add_yet ich9: Document why cannot_instantiate_with_device_add_yet piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet vt82c686: Clean up use of cannot_instantiate_with_device_add_yet isa: Clean up use of cannot_instantiate_with_device_add_yet qdev: Do not let the user try to device_add when it cannot work hw/acpi/piix4.c | 6 +++++- hw/alpha/typhoon.c | 2 -- hw/arm/versatilepb.c | 1 - hw/audio/pcspk.c | 3 ++- hw/audio/pl041.c | 1 - hw/block/fdc.c | 1 - hw/core/sysbus.c | 7 +++++++ hw/display/pl110.c | 1 - hw/dma/pl080.c | 1 - hw/i2c/smbus_ich9.c | 6 +++++- hw/i386/kvm/clock.c | 1 - hw/i386/kvmvapic.c | 1 - hw/i386/pc.c | 7 ++++++- hw/ide/piix.c | 3 --- hw/ide/via.c | 1 - hw/input/pckbd.c | 1 - hw/input/vmmouse.c | 3 ++- hw/intc/apic_common.c | 6 +++++- hw/intc/arm_gic.c | 1 - hw/intc/arm_gic_common.c | 1 - hw/intc/arm_gic_kvm.c | 1 - hw/intc/i8259_common.c | 8 +++++++- hw/intc/ioapic_common.c | 1 - hw/intc/pl190.c | 1 - hw/isa/isa-bus.c | 1 - hw/isa/lpc_ich9.c | 7 +++++-- hw/isa/piix4.c | 6 +++++- hw/isa/vt82c686.c | 6 +++++- hw/mips/gt64xxx_pci.c | 6 ++++++ hw/misc/arm_l2x0.c | 1 - hw/misc/vmport.c | 3 ++- hw/nvram/fw_cfg.c | 1 - hw/pci-bridge/dec.c | 6 ++++++ hw/pci-host/apb.c | 6 ++++++ hw/pci-host/bonito.c | 8 +++++--- hw/pci-host/grackle.c | 8 +++++--- hw/pci-host/piix.c | 19 +++++++++++++++---- hw/pci-host/ppce500.c | 5 +++++ hw/pci-host/prep.c | 7 +++++-- hw/pci-host/q35.c | 5 +++++ hw/pci-host/uninorth.c | 24 ++++++++++++++++++++++++ hw/pci-host/versatile.c | 6 ++++++ hw/ppc/ppc4xx_pci.c | 5 +++++ hw/ppc/spapr_vio.c | 2 -- hw/s390x/ipl.c | 1 - hw/s390x/s390-virtio-bus.c | 2 -- hw/s390x/virtio-ccw.c | 2 -- hw/sd/pl181.c | 1 - hw/sh4/sh_pci.c | 6 ++++++ hw/timer/arm_mptimer.c | 1 - hw/timer/hpet.c | 1 - hw/timer/i8254_common.c | 7 ++++++- hw/timer/m48t59.c | 3 ++- hw/timer/mc146818rtc.c | 3 ++- hw/timer/pl031.c | 1 - include/hw/qdev-core.h | 13 ++++++++++++- qdev-monitor.c | 10 ++++++++-- qom/cpu.c | 6 +++++- 58 files changed, 190 insertions(+), 64 deletions(-) -- 1.8.1.4