From: Kevin Wolf <kwolf@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, armbru@redhat.com, berrange@redhat.com,
peter.maydell@linaro.org, pbonzini@redhat.com, philmd@linaro.org
Subject: Re: [PATCH v2 12/12] qdev: Rework array properties based on list visitor
Date: Tue, 31 Oct 2023 12:09:20 +0100 [thread overview]
Message-ID: <ZUDgYFuGiqImrbOP@redhat.com> (raw)
In-Reply-To: <92dce7a5-6a1c-41bd-8ac0-3884e4ad9ab3@ilande.co.uk>
Am 30.10.2023 um 21:48 hat Mark Cave-Ayland geschrieben:
> On 30/10/2023 14:26, Kevin Wolf 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, 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.
>
> Is it possible to find a suitable place in the documentation to show
> how the new array syntax is used with -device on the command line? The
> description above is really useful, but I can see this being quite
> hard for users to find if it is only documented in the commit message.
Actually, it seems that the documentation doesn't explicitly mention
JSON syntax for command line options anywhere. Support for it is quite
widespread meanwhile. I can see it for at least:
-audiodev
-blockdev
-compat
-device
-display
-netdev
-object
In qemu-storage-daemon, it's additionally supported for:
--export
--monitor
--nbd-server
I think the manpage should at least mention for each of these options
that they support JSON.
Ideally, we'd then have a generic section that describes the mapping
between JSON and human syntax, but unfortunately, the human oriented
parsers differ quite a lot between these options, so there is nothing we
can describe and that is valid for all options. So maybe things like
"Specifying values for list properties is only possible with JSON
syntax" must be specified for each option where it applies.
Kevin
next prev parent reply other threads:[~2023-10-31 11:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 14:26 [PATCH v2 00/12] qdev: Make array properties user accessible again Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 01/12] qdev: Add qdev_prop_set_array() Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 02/12] hw/i386/pc: Use qdev_prop_set_array() Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 03/12] hw/arm/mps2-tz: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 04/12] hw/arm/mps2: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 05/12] hw/arm/sbsa-ref: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 06/12] hw/arm/vexpress: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 07/12] hw/arm/virt: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 08/12] hw/arm/xlnx-versal: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 09/12] hw/rx/rx62n: " Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 10/12] qom: Add object_property_set_default_list() Kevin Wolf
2023-10-30 14:26 ` [PATCH v2 11/12] qdev: Make netdev properties work as list elements Kevin Wolf
2023-11-02 12:55 ` Markus Armbruster
2023-11-07 13:35 ` Kevin Wolf
2023-11-08 6:50 ` Markus Armbruster
2023-10-30 14:26 ` [PATCH v2 12/12] qdev: Rework array properties based on list visitor Kevin Wolf
2023-10-30 20:48 ` Mark Cave-Ayland
2023-10-31 11:09 ` Kevin Wolf [this message]
2023-11-02 13:29 ` Markus Armbruster
2023-11-03 12:32 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUDgYFuGiqImrbOP@redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).