qemu-e2k/hw
Kevin Wolf b06f8b500d qdev: Rework array properties based on list visitor
Until now, array properties are actually implemented with a hack that
uses multiple properties on the QOM level: a static "foo-len" property
and after it is set, dynamically created "foo[i]" properties.

In external interfaces (-device on the command line and device_add in
QMP), this interface was broken by commit f3558b1b ('qdev: Base object
creation on QDict rather than QemuOpts') because QDicts are unordered
and therefore it could happen that QEMU tried to set the indexed
properties before setting the length, which fails and effectively makes
array properties inaccessible. In particular, this affects the 'ports'
property of the 'rocker' device, which used to be configured like this:

-device rocker,len-ports=2,ports[0]=dev0,ports[1]=dev1

This patch reworks the external interface so that instead of using a
separate top-level property for the length and for each element, we use
a single true array property that accepts a list value. In the external
interfaces, this is naturally expressed as a JSON list and makes array
properties accessible again. The new syntax looks like this:

-device '{"driver":"rocker","ports":["dev0","dev1"]}'

Creating an array property on the command line without using JSON format
is currently not possible. This could be fixed by switching from
QemuOpts to a keyval parser, which however requires consideration of the
compatibility implications.

All internal users of devices with array properties go through
qdev_prop_set_array() at this point, so updating it takes care of all of
them.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1090
Fixes: f3558b1b76
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231109174240.72376-12-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-11-10 18:19:19 +01:00
..
9pfs
acpi
adc
alpha hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
arm hw/arm/xlnx-versal: Use qdev_prop_set_array() 2023-11-10 18:19:13 +01:00
audio virtio-sound: implement audio capture (RX) 2023-11-07 03:39:10 -05:00
avr
block hw/xen: automatically assign device index to block devices 2023-11-07 08:54:20 +00:00
char hw/xen: add support for Xen primary console in emulated mode 2023-11-07 08:54:20 +00:00
core qdev: Rework array properties based on list visitor 2023-11-10 18:19:19 +01:00
cpu
cris
cxl hw/cxl: Add tunneled command support to mailbox for switch cci. 2023-11-07 03:39:11 -05:00
display hw/display/ati: allow compiling without PIXMAN 2023-11-07 14:04:25 +04:00
dma
gpio
hppa hw/hppa: Allow C3700 with 64-bit and B160L with 32-bit CPU only 2023-11-06 18:49:34 -08:00
hyperv vfio queue: 2023-11-07 09:41:52 +08:00
i2c hw/i2c: pmbus: reset page register for out of range reads 2023-11-07 13:08:49 +01:00
i386 hw/i386/pc: Use qdev_prop_set_array() 2023-11-10 18:19:07 +01:00
ide Block layer patches 2023-11-09 08:26:01 +08:00
input target-arm queue: 2023-11-03 10:04:12 +08:00
intc
ipack
ipmi
isa hw/isa/i82378: Propagate error if PC_SPEAKER device creation failed 2023-11-07 13:08:48 +01:00
loongarch
m68k
mem virtio,pc,pci: features, fixes 2023-11-07 18:59:41 +08:00
microblaze
mips hw/mips: FULOONG depends on VT82C686 2023-11-07 14:04:25 +04:00
misc
net hw/xen: update Xen PV NIC to XenDevice model 2023-11-07 08:54:20 +00:00
nios2
nubus
nvme
nvram
openrisc
pci hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
pci-bridge hw/pci-bridge/cxl_downstream: Set default link width and link speed 2023-11-07 03:39:11 -05:00
pci-host hw/pci-host: Update PHB5 XSCOM registers 2023-11-07 15:49:41 -03:00
pcmcia
ppc ppc patch queue for 2023-11-07: 2023-11-08 20:35:00 +08:00
rdma
remote hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
riscv target/riscv: Use existing PMU counter mask in FDT generation 2023-11-07 11:06:02 +10:00
rtc mc146818rtc: rtc_set_time(): initialize tm to zeroes 2023-11-06 15:00:27 +00:00
rx hw/rx/rx62n: Use qdev_prop_set_array() 2023-11-10 18:19:13 +01:00
s390x hw/s390x/sclp: Have sclp_service_call[_protected]() take S390CPU* 2023-11-07 13:08:48 +01:00
scsi
sd hw/sd: Declare QOM types using DEFINE_TYPES() macro 2023-11-07 13:08:49 +01:00
sensor hw/sensor: add ADM1266 device model 2023-11-07 13:08:49 +01:00
sh4
smbios
sparc
sparc64
ssi hw/ssi: ibex_spi_host: Clear the interrupt even if disabled 2023-11-07 11:06:02 +10:00
timer
tpm
tricore
ufs
usb
vfio vfio/common: Move vfio_host_win_add/del into spapr.c 2023-11-06 13:23:23 +01:00
virtio virtio,pc,pci: features, fixes 2023-11-07 18:59:41 +08:00
watchdog
xen hw/i386/pc: support '-nic' for xen-net-device 2023-11-07 08:54:20 +00:00
xenpv hw/xen: update Xen PV NIC to XenDevice model 2023-11-07 08:54:20 +00:00
xtensa
Kconfig
meson.build