From: Kevin Wolf <kwolf@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Eric Blake" <eblake@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-arm@nongnu.org, "Luc Michel" <luc.michel@amd.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Frederic Konrad" <fkonrad@amd.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC PATCH 0/5] qdev-properties: Try to improve use of dynamic property introspection
Date: Tue, 9 Jan 2024 11:47:45 +0100 [thread overview]
Message-ID: <ZZ0kUcy14YA8t3Pd@redhat.com> (raw)
In-Reply-To: <20240102160455.68612-1-philmd@linaro.org>
Am 02.01.2024 um 17:04 hat Philippe Mathieu-Daudé geschrieben:
> Hi,
>
> This RFC series tries to work over some limitations exposed in
> https://lore.kernel.org/qemu-devel/9293e63b-8032-4ea0-b516-9db6949fb607@linaro.org/
>
> Eventually all QDev objects would use static QOM properties,
> but in some cases we can not. ARMv7MState is a such example
> adding properties that might end up irrelevant.
>
> This is just an example, but thinking long term (in particular
> in the context of dynamic machines) I'm looking at how this
> could be improved. Thus this series. I don't like much this
> current approach (because more boiler place and complexity)
> however this seems to DTRT for the user.
This doesn't feel like the right approach to me. If you were to describe
the properties of armv7m in the QAPI schema language without looking at
the implementation, you would never add something like OptionalBool.
I'm not entirely sure if I understand the details of the problem, so if
I make wrong assumptions below, please correct me.
I think what you would get instead is a union with the different CPU
types as union variants. You would have few fields in the base type
(cpu-type, memory, etc.), and everything specific to the variant, you
wouldn't even want to look at in armv7m, but just forward it to the CPU.
Now of course actually getting this QAPIfied is not something to expect
in the next few days, so let's get back to the QOM level, but keep the
general idea in mind.
Based on the above, I'd argue that armv7m shouldn't even have the
properties that it only uses to forward them. Instead, we should let the
CPU grab its properties directly from the configuration. The way we
create objects currently is not really designed for this. But let's get
back to the QOM/QAPI integration patches [1] I sent two years ago and
suddently it becomes quite easy: armv7m's .instance_config simply calls
the CPU's .instance_config and passes its visitor. Then the CPU takes
the options it needs for its properties and that's it.
I discussed this series with Markus recently, and I actually assume that
he at least mentioned it to you when you discussed things with him. I
believe the part that you would need here (only up to patch 4 really) is
pretty much uncontroversial.
Of course, I ignored several "details" here, but I think the idea should
still be workable. Some of those details:
* This approach requires that the CPUs are first converted to have
static properties, but given that making everything static is your
goal, I assume that's not a problem.
* The CPU must actually exist when you want to set properties for it.
This probably means moving creating the CPU from realize to the new
instance_config.
* My patches are for object-add, but we're coming from board code here.
So the callers would have to be changed to call .instance_config
(probalby indirectly through object_configure()) instead of setting
individual properties.
All of this is additional work, but it doesn't look like exceedingly
hard work.
Kevin
[1] https://patchew.org/QEMU/20211103173002.209906-1-kwolf@redhat.com/
prev parent reply other threads:[~2024-01-09 10:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 16:04 [RFC PATCH 0/5] qdev-properties: Try to improve use of dynamic property introspection Philippe Mathieu-Daudé
2024-01-02 16:04 ` [RFC PATCH 1/5] qdev-properties: Add qdev_property_del_static() Philippe Mathieu-Daudé
2024-01-02 16:04 ` [RFC PATCH 2/5] qdev-properties: Add OptionalBool QAPI type Philippe Mathieu-Daudé
2024-01-02 22:44 ` Richard Henderson
2024-01-03 9:12 ` Philippe Mathieu-Daudé
2024-01-02 16:04 ` [RFC PATCH 3/5] hw/arm/armv7m: Convert ARMv7MState::vfp from bool to OptionalBool Philippe Mathieu-Daudé
2024-01-02 16:04 ` [RFC PATCH 4/5] hw/arm/armv7m: Error if trying to set unavailable ARMCPU::vfp property Philippe Mathieu-Daudé
2024-01-12 16:41 ` Peter Maydell
2024-01-02 16:04 ` [RFC PATCH 5/5] hw/arm/armv7m: Do not expose 'vfp' property if ARM CPU doesn't have it Philippe Mathieu-Daudé
2024-01-09 10:47 ` Kevin Wolf [this message]
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=ZZ0kUcy14YA8t3Pd@redhat.com \
--to=kwolf@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=fkonrad@amd.com \
--cc=luc.michel@amd.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.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).