qemu-e2k/include/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
..
acpi virtio,pc,pci: features, cleanups 2023-10-23 14:45:29 -07:00
adc
arm hw/arm: xlnx-versal-virt: Add AMD/Xilinx TRNG device 2023-11-02 14:42:03 +00:00
audio virtio-sound: implement audio output (TX) 2023-11-07 03:39:10 -05:00
block
char hw/char/stm32f2xx_usart: Add more definitions for CR1 register 2023-11-02 13:36:45 +00:00
core hw/cpu: Update the comments of nr_cores and nr_dies 2023-11-07 13:08:48 +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 ramfb: add migration support 2023-10-18 10:10:49 +02:00
dma
firmware
gpio
hyperv Add Hyper-V Dynamic Memory Protocol driver (hv-balloon) base 2023-11-06 14:08:10 +01:00
i2c hw/i2c: pmbus: add VCAP register 2023-11-07 13:08:49 +01:00
i386 Misc hardware patch queue 2023-11-08 08:32:26 +08:00
ide
input hw/input/stellaris_gamepad: Convert to qemu_input_handler_register() 2023-11-02 12:52:06 +00:00
intc hw/m68k/irqc: Pass CPU using QOM link property 2023-11-01 07:20:34 +01:00
ipack
ipmi
isa
loongarch hw/loongarch/virt: Remove unused ISA Bus 2023-10-13 10:03:47 +08:00
m68k hw/char/mcf_uart: Have mcf_uart_create() return DeviceState 2023-11-01 07:31:05 +01:00
mem memory-device: Support empty memory devices 2023-11-03 20:26:59 +01:00
mips hw/mips: Merge 'hw/mips/cpudevs.h' with 'target/mips/cpu.h' 2023-10-19 23:13:27 +02:00
misc hw/misc: Introduce AMD/Xilix Versal TRNG device 2023-11-02 14:42:03 +00:00
net
nubus
nvram xlnx-bbram: hw/nvram: Use dot in device type name 2023-10-19 14:32:12 +01:00
openrisc
pci hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
pci-bridge hw/cxl: Add a switch mailbox CCI function 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
ppc ppc patch queue for 2023-11-07: 2023-11-08 20:35:00 +08:00
rdma
remote
riscv
rtc
rx
s390x * Fix s390x CPU reconfiguration information in the SCLP facility map 2023-11-08 20:34:36 +08:00
scsi
sd
sensor
sh4
southbridge hw/isa/piix: Allow for optional PIT creation in PIIX3 2023-10-22 05:18:17 -04:00
sparc
ssi
timer
tricore
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 Xen: Fix xen_set_irq() and xendevicemodel_set_irq_level() 2023-11-07 13:03:19 -08:00
xtensa
boards.h CPU topology: extend with s390 specifics 2023-10-20 07:16:53 +02:00
clock.h
elf_ops.h include/hw/elf: Remove truncating signed casts 2023-11-06 18:49:34 -08:00
fw-path-provider.h
hotplug.h
hw.h
ide.h
irq.h
loader-fit.h
loader.h hw/loader: Clean up global variable shadowing in rom_add_file() 2023-11-07 13:08:48 +01:00
nmi.h
or-irq.h
pcmcia.h
platform-bus.h
ptimer.h
qdev-clock.h
qdev-core.h
qdev-dma.h
qdev-properties-system.h migration: mode parameter 2023-11-01 16:13:58 +01:00
qdev-properties.h qdev: Rework array properties based on list visitor 2023-11-10 18:19:19 +01:00
register.h
registerfields.h
resettable.h
stream.h
sysbus.h
usb.h
vmstate-if.h