[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/11] qdev: Rework array properties based on list visitor
From: |
Peter Maydell |
Subject: |
Re: [PATCH 11/11] qdev: Rework array properties based on list visitor |
Date: |
Fri, 8 Sep 2023 16:18:55 +0100 |
On Fri, 8 Sept 2023 at 15:37, Kevin Wolf <kwolf@redhat.com> wrote:
>
> 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.
>
> 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.
>
> 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.
Could we have a specific example in the commit message of:
The old (currently broken) syntax for setting the ports
property on the rocker device is:
-device rocker,len-ports=2,ports[0]=dev0,ports[1]=dev1
The new syntax that works as of this commit is:
[whatever]
?
I would expect most users have no idea what the JSON list
syntax is.
thanks
-- PMM
- Re: [PATCH 02/11] hw/i386/pc: Use qdev_prop_set_array(), (continued)
- [PATCH 05/11] hw/arm/sbsa-ref: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08
- [PATCH 04/11] hw/arm/mps2: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08
- [PATCH 06/11] hw/arm/vexpress: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08
- [PATCH 07/11] hw/arm/virt: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08
- [PATCH 11/11] qdev: Rework array properties based on list visitor, Kevin Wolf, 2023/09/08
- [PATCH 09/11] hw/rx/rx62n: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08
- [PATCH 08/11] hw/arm/xlnx-versal: Use qdev_prop_set_array(), Kevin Wolf, 2023/09/08