qemu-patch-raspberry4/hw/misc
Eduardo Habkost e4f4fb1eca sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE
commit 33cd52b5d7 unset
cannot_instantiate_with_device_add_yet in TYPE_SYSBUS, making all
sysbus devices appear on "-device help" and lack the "no-user"
flag in "info qdm".

To fix this, we can set user_creatable=false by default on
TYPE_SYS_BUS_DEVICE, but this requires setting
user_creatable=true explicitly on the sysbus devices that
actually work with -device.

Fortunately today we have just a few has_dynamic_sysbus=1
machines: virt, pc-q35-*, ppce500, and spapr.

virt, ppce500, and spapr have extra checks to ensure just a few
device types can be instantiated:

* virt supports only TYPE_VFIO_CALXEDA_XGMAC, TYPE_VFIO_AMD_XGBE.
* ppce500 supports only TYPE_ETSEC_COMMON.
* spapr supports only TYPE_SPAPR_PCI_HOST_BRIDGE.

This patch sets user_creatable=true explicitly on those 4 device
classes.

Now, the more complex cases:

pc-q35-*: q35 has no sysbus device whitelist yet (which is a
separate bug). We are in the process of fixing it and building a
sysbus whitelist on q35, but in the meantime we can fix the
"-device help" and "info qdm" bugs mentioned above. Also, despite
not being strictly necessary for fixing the q35 bug, reducing the
list of user_creatable=true devices will help us be more
confident when building the q35 whitelist.

xen: We also have a hack at xen_set_dynamic_sysbus(), that sets
has_dynamic_sysbus=true at runtime when using the Xen
accelerator. This hack is only used to allow xen-backend devices
to be dynamically plugged/unplugged.

This means today we can use -device with the following 22 device
types, that are the ones compiled into the qemu-system-x86_64 and
qemu-system-i386 binaries:

* allwinner-ahci
* amd-iommu
* cfi.pflash01
* esp
* fw_cfg_io
* fw_cfg_mem
* generic-sdhci
* hpet
* intel-iommu
* ioapic
* isabus-bridge
* kvmclock
* kvm-ioapic
* kvmvapic
* SUNW,fdtwo
* sysbus-ahci
* sysbus-fdc
* sysbus-ohci
* unimplemented-device
* virtio-mmio
* xen-backend
* xen-sysdev

This patch adds user_creatable=true explicitly to those devices,
temporarily, just to keep 100% compatibility with existing
behavior of q35. Subsequent patches will remove
user_creatable=true from the devices that are really not meant to
user-creatable on any machine, and remove the FIXME comment from
the ones that are really supposed to be user-creatable. This is
being done in separate patches because we still don't have an
obvious list of devices that will be whitelisted by q35, and I
would like to get each device reviewed individually.

Cc: Alexander Graf <agraf@suse.de>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Alistair Francis <alistair.francis@xilinx.com>
Cc: Beniamino Galvani <b.galvani@gmail.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Frank Blaschka <frank.blaschka@de.ibm.com>
Cc: Gabriel L. Somlo <somlo@cmu.edu>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: John Snow <jsnow@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Pierre Morel <pmorel@linux.vnet.ibm.com>
Cc: Prasad J Pandit <pjp@fedoraproject.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-ppc@nongnu.org
Cc: Richard Henderson <rth@twiddle.net>
Cc: Rob Herring <robh@kernel.org>
Cc: Shannon Zhao <zhaoshenglong@huawei.com>
Cc: sstabellini@kernel.org
Cc: Thomas Huth <thuth@redhat.com>
Cc: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Acked-by: John Snow <jsnow@redhat.com>
Acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170503203604.31462-3-ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[ehabkost: Small changes at sysbus_device_class_init() comments]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-05-17 10:37:01 -03:00
..
macio ppc: Fix macio ESCC legacy mapping 2016-09-07 12:40:12 +10:00
a9scu.c arm: Clean up includes 2016-01-29 15:07:23 +00:00
applesmc.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
arm11scu.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
arm_integrator_debug.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
arm_l2x0.c hw/misc: QOM'ify arm_l2x0.c 2016-06-14 15:59:14 +01:00
arm_sysctl.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
aspeed_scu.c aspeed/scu: fix SCU region size 2016-12-27 14:59:28 +00:00
aspeed_sdmc.c aspeed: add the definitions for the AST2400 A1 SoC 2016-12-27 14:59:28 +00:00
auxbus.c aux: Rename aux.[ch] to auxbus.[ch] for the benefit of Windows 2016-07-07 13:47:01 +01:00
bcm2835_mbox.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
bcm2835_property.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
bcm2835_rng.c bcm2835_rng: Use qcrypto_random_bytes() rather than rand() 2017-02-28 12:08:14 +00:00
cbus.c include/hw/hw.h: Don't include qemu-common.h 2016-03-22 22:20:16 +01:00
debugexit.c x86: Clean up includes 2016-01-29 15:07:22 +00:00
eccmemctl.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
edu.c hw/misc/edu: support MSI interrupt 2016-10-04 10:00:25 +02:00
exynos4210_clk.c hw/arm/exynos: Fix Linux kernel division by zero for PLLs 2017-02-28 12:08:20 +00:00
exynos4210_pmu.c hw/misc/exynos4210_pmu: Reorder local variables for readability 2017-04-20 17:39:17 +01:00
hyperv_testdev.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
imx6_ccm.c imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx6_src.c hw/misc/imx6_src: Don't crash trying to reset missing CPUs 2017-03-14 16:13:22 +00:00
imx25_ccm.c imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx31_ccm.c imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx_ccm.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
ivshmem.c util/cutils: Change qemu_strtosz*() from int64_t to uint64_t 2017-02-23 20:35:36 +01:00
Makefile.objs hw/arm/exynos: Fix Linux kernel division by zero for PLLs 2017-02-28 12:08:20 +00:00
max111x.c ssi: change ssi_slave_init to be a realize ops 2016-07-04 13:15:22 +01:00
milkymist-hpdmc.c milkymist: update specification URLs 2016-06-20 18:12:04 +02:00
milkymist-pfpu.c char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
mips_cmgcr.c hw/mips_cmgcr: allow GCR base to be moved 2017-02-21 22:24:58 +00:00
mips_cpc.c hw/mips_cpc: make VP correctly start from the reset vector 2016-07-12 09:10:15 +01:00
mips_itu.c cpu: move exec-all.h inclusion out of cpu.h 2016-05-19 16:42:29 +02:00
mst_fpga.c hw/misc: QOM'ify mst_fpga.c 2016-06-14 15:59:14 +01:00
omap_clk.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
omap_gpmc.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
omap_l4.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
omap_sdrc.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
omap_tap.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
pc-testdev.c os-posix: include sys/mman.h 2016-06-16 18:39:03 +02:00
pci-testdev.c dma: do not depend on kvm_enabled() 2016-05-19 16:42:28 +02:00
puv3_pm.c unicore: Clean up includes 2016-01-29 15:07:22 +00:00
pvpanic.c report guest crash information in GUEST_PANICKED event 2017-02-16 15:30:49 +01:00
sga.c x86: Clean up includes 2016-01-29 15:07:22 +00:00
slavio_misc.c hw/misc: Clean up includes 2016-01-29 15:07:24 +00:00
stm32f2xx_syscfg.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
tmp105.c i2c: Allow I2C devices to NAK start events 2017-01-09 11:40:20 +00:00
tmp105.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
trace-events trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
unimp.c sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE 2017-05-17 10:37:01 -03:00
vmport.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
zynq-xadc.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
zynq_slcr.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00