[RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection

Markus Armbruster posted 6 patches 1 week, 6 days ago
docs/sphinx/qapidoc.py     |  2 +-
scripts/qapi/introspect.py | 74 ++++++++++----------------------------
scripts/qapi/schema.py     | 57 +++++++++++++++++++++++------
3 files changed, 67 insertions(+), 66 deletions(-)
[RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Markus Armbruster 1 week, 6 days ago
Marc-André Lureau has patches to improve QOM introspection.  Latest
version is

    Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types 
    Date: Fri, 11 Sep 2026 20:34:34 +0400
    Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
    https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/

The first few patches make the QAPI code generator emit type
information for use by QOM introspection commands.  They refactor code
to gain access to masked type names, and to make query-qmp-schema not
elide types QOM introspection might want to refer to.

My series does this in a different way I find simpler.  It is RFC
because merging it only makes sense if Marc-André finds it useful.
Marc-André, please have a look.

Markus Armbruster (6):
  qapi/schema: Rename .lookup_entity() and tighten return type
  qapi: Ease access to introspection names
  qapi/introspect: Simplify masked name comment emission slighly
  qapi/introspect: Don't elide types
  qapi: QAPISchemaVisitor.visit_needed() is now unused, drop
  qapi/introspect: Tweak integer type masking

 docs/sphinx/qapidoc.py     |  2 +-
 scripts/qapi/introspect.py | 74 ++++++++++----------------------------
 scripts/qapi/schema.py     | 57 +++++++++++++++++++++++------
 3 files changed, 67 insertions(+), 66 deletions(-)

-- 
2.55.0


Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Marc-André Lureau 1 week, 6 days ago
Hi Markus

On Fri, Oct 9, 2026 at 6:05 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Marc-André Lureau has patches to improve QOM introspection.  Latest
> version is
>
>     Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types
>     Date: Fri, 11 Sep 2026 20:34:34 +0400
>     Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
>     https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/
>
> The first few patches make the QAPI code generator emit type
> information for use by QOM introspection commands.  They refactor code
> to gain access to masked type names, and to make query-qmp-schema not
> elide types QOM introspection might want to refer to.
>
> My series does this in a different way I find simpler.  It is RFC
> because merging it only makes sense if Marc-André finds it useful.
> Marc-André, please have a look.

This is essentially doing the same introspection changes but at a
different level. If you ask me, since it's essentially code cleanup at
this point, I would rather merge my changes first and iterate on top.
But you are the gate keeper, so I wouldn't hold it, we need to move
on... I can rebase on top of your refactoring if you prefer.


> Markus Armbruster (6):
>   qapi/schema: Rename .lookup_entity() and tighten return type
>   qapi: Ease access to introspection names
>   qapi/introspect: Simplify masked name comment emission slighly
>   qapi/introspect: Don't elide types
>   qapi: QAPISchemaVisitor.visit_needed() is now unused, drop
>   qapi/introspect: Tweak integer type masking
>
>  docs/sphinx/qapidoc.py     |  2 +-
>  scripts/qapi/introspect.py | 74 ++++++++++----------------------------
>  scripts/qapi/schema.py     | 57 +++++++++++++++++++++++------
>  3 files changed, 67 insertions(+), 66 deletions(-)
>
> --
> 2.55.0
>
>
Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Markus Armbruster 1 week, 2 days ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi Markus
>
> On Fri, Oct 9, 2026 at 6:05 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Marc-André Lureau has patches to improve QOM introspection.  Latest
>> version is
>>
>>     Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types
>>     Date: Fri, 11 Sep 2026 20:34:34 +0400
>>     Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
>>     https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/
>>
>> The first few patches make the QAPI code generator emit type
>> information for use by QOM introspection commands.  They refactor code
>> to gain access to masked type names, and to make query-qmp-schema not
>> elide types QOM introspection might want to refer to.
>>
>> My series does this in a different way I find simpler.  It is RFC
>> because merging it only makes sense if Marc-André finds it useful.
>> Marc-André, please have a look.
>
> This is essentially doing the same introspection changes but at a
> different level. If you ask me, since it's essentially code cleanup at
> this point, I would rather merge my changes first and iterate on top.
> But you are the gate keeper, so I wouldn't hold it, we need to move
> on... I can rebase on top of your refactoring if you prefer.

A rebase gives me a cleaner git history, which I like.  Asking you to do
it feels a bit unfair, so I did it:

    https://repo.or.cz/qemu/armbru.git/shortlog/refs/heads/qom-props-qapi-types-v5-rebased

I had to change "qapi: add type-infos generator" quite a bit (commit
465ae98da2).  Slightly simpler now.

I resolved a rebase conflict in "qom: convert scalar properties to
QAPI-aware registration".

I dropped "qapi: expose integer signedness and width in introspection"
because I don't agree with it, and couldn't be bothered to resolve the
conflict (iirc).

I dropped "qapi: select introspectable types directly", because it's not
needed anymore.
Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Marc-André Lureau 1 week, 2 days ago
Hi

On Tue, Oct 13, 2026 at 5:57 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> > Hi Markus
> >
> > On Fri, Oct 9, 2026 at 6:05 PM Markus Armbruster <armbru@redhat.com> wrote:
> >>
> >> Marc-André Lureau has patches to improve QOM introspection.  Latest
> >> version is
> >>
> >>     Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types
> >>     Date: Fri, 11 Sep 2026 20:34:34 +0400
> >>     Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
> >>     https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/
> >>
> >> The first few patches make the QAPI code generator emit type
> >> information for use by QOM introspection commands.  They refactor code
> >> to gain access to masked type names, and to make query-qmp-schema not
> >> elide types QOM introspection might want to refer to.
> >>
> >> My series does this in a different way I find simpler.  It is RFC
> >> because merging it only makes sense if Marc-André finds it useful.
> >> Marc-André, please have a look.
> >
> > This is essentially doing the same introspection changes but at a
> > different level. If you ask me, since it's essentially code cleanup at
> > this point, I would rather merge my changes first and iterate on top.
> > But you are the gate keeper, so I wouldn't hold it, we need to move
> > on... I can rebase on top of your refactoring if you prefer.
>
> A rebase gives me a cleaner git history, which I like.  Asking you to do
> it feels a bit unfair, so I did it:
>
>     https://repo.or.cz/qemu/armbru.git/shortlog/refs/heads/qom-props-qapi-types-v5-rebased

Awesome, I am happy with that! If you want to resubmit on ML or send
PR, up to you

I think the only local change I had (with the collected review
trailers), was BootCertificatesList conversion. But that can be a
follow up.

>
> I had to change "qapi: add type-infos generator" quite a bit (commit
> 465ae98da2).  Slightly simpler now.
>t

ok

> I resolved a rebase conflict in "qom: convert scalar properties to
> QAPI-aware registration".
>
> I dropped "qapi: expose integer signedness and width in introspection"
> because I don't agree with it, and couldn't be bothered to resolve the
> conflict (iirc).
>

Ok, let's discuss this separately

> I dropped "qapi: select introspectable types directly", because it's not
> needed anymore.
>
Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Markus Armbruster 1 week, 1 day ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi
>
> On Tue, Oct 13, 2026 at 5:57 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>>
>> > Hi Markus
>> >
>> > On Fri, Oct 9, 2026 at 6:05 PM Markus Armbruster <armbru@redhat.com> wrote:
>> >>
>> >> Marc-André Lureau has patches to improve QOM introspection.  Latest
>> >> version is
>> >>
>> >>     Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types
>> >>     Date: Fri, 11 Sep 2026 20:34:34 +0400
>> >>     Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
>> >>     https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/
>> >>
>> >> The first few patches make the QAPI code generator emit type
>> >> information for use by QOM introspection commands.  They refactor code
>> >> to gain access to masked type names, and to make query-qmp-schema not
>> >> elide types QOM introspection might want to refer to.
>> >>
>> >> My series does this in a different way I find simpler.  It is RFC
>> >> because merging it only makes sense if Marc-André finds it useful.
>> >> Marc-André, please have a look.
>> >
>> > This is essentially doing the same introspection changes but at a
>> > different level. If you ask me, since it's essentially code cleanup at
>> > this point, I would rather merge my changes first and iterate on top.
>> > But you are the gate keeper, so I wouldn't hold it, we need to move
>> > on... I can rebase on top of your refactoring if you prefer.
>>
>> A rebase gives me a cleaner git history, which I like.  Asking you to do
>> it feels a bit unfair, so I did it:
>>
>>     https://repo.or.cz/qemu/armbru.git/shortlog/refs/heads/qom-props-qapi-types-v5-rebased
>
> Awesome, I am happy with that! If you want to resubmit on ML or send
> PR, up to you

Great!

I'd like to have a closer look at a few more patches.  They look
harmless at a glance.

> I think the only local change I had (with the collected review
> trailers), was BootCertificatesList conversion. But that can be a
> follow up.

Happy to squash it in, feel free to send me a delta, a revised patch, or
something to git-fetch.

There's also a temporary test breakage in PATCH 15.  Could you have a
look?

[...]
Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Marc-André Lureau 1 week, 1 day ago
Hi

On Wed, Oct 14, 2026 at 10:10 AM Markus Armbruster <armbru@redhat.com> wrote:
>
> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> > Hi
> >
> > On Tue, Oct 13, 2026 at 5:57 PM Markus Armbruster <armbru@redhat.com> wrote:
> >>
> >> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
> >>
> >> > Hi Markus
> >> >
> >> > On Fri, Oct 9, 2026 at 6:05 PM Markus Armbruster <armbru@redhat.com> wrote:
> >> >>
> >> >> Marc-André Lureau has patches to improve QOM introspection.  Latest
> >> >> version is
> >> >>
> >> >>     Subject: [PATCH v5 00/62] qom/qdev: associate properties with QAPI schema types
> >> >>     Date: Fri, 11 Sep 2026 20:34:34 +0400
> >> >>     Message-Id: <20260911-qom-qapi-v5-0-7732a55b7760@redhat.com>
> >> >>     https://lore.kernel.org/qemu-devel/20260911-qom-qapi-v5-0-7732a55b7760@redhat.com/
> >> >>
> >> >> The first few patches make the QAPI code generator emit type
> >> >> information for use by QOM introspection commands.  They refactor code
> >> >> to gain access to masked type names, and to make query-qmp-schema not
> >> >> elide types QOM introspection might want to refer to.
> >> >>
> >> >> My series does this in a different way I find simpler.  It is RFC
> >> >> because merging it only makes sense if Marc-André finds it useful.
> >> >> Marc-André, please have a look.
> >> >
> >> > This is essentially doing the same introspection changes but at a
> >> > different level. If you ask me, since it's essentially code cleanup at
> >> > this point, I would rather merge my changes first and iterate on top.
> >> > But you are the gate keeper, so I wouldn't hold it, we need to move
> >> > on... I can rebase on top of your refactoring if you prefer.
> >>
> >> A rebase gives me a cleaner git history, which I like.  Asking you to do
> >> it feels a bit unfair, so I did it:
> >>
> >>     https://repo.or.cz/qemu/armbru.git/shortlog/refs/heads/qom-props-qapi-types-v5-rebased
> >
> > Awesome, I am happy with that! If you want to resubmit on ML or send
> > PR, up to you
>
> Great!
>
> I'd like to have a closer look at a few more patches.  They look
> harmless at a glance.
>
> > I think the only local change I had (with the collected review
> > trailers), was BootCertificatesList conversion. But that can be a
> > follow up.
>
> Happy to squash it in, feel free to send me a delta, a revised patch, or
> something to git-fetch.

commit ed3c302c506fc9de30a540f7ed8274e82baa295c
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Wed Sep 23 14:32:43 2026 +0400

    hw/s390x: convert BootCertificatesList to QAPI-aware registration

    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 9ca3b14442e1..97e122e3e7db 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -44,6 +44,7 @@
 #include "target/s390x/kvm/pv.h"
 #include "migration/blocker.h"
 #include "qapi/qapi-builtin-type-infos.h"
+#include "qapi/qapi-type-infos-machine-s390x.h"
 #include "qapi/visitor.h"
 #include "qapi/qapi-visit-machine-s390x.h"
 #include "hw/s390x/cpu-topology.h"
@@ -918,8 +919,10 @@ static void ccw_machine_class_init(ObjectClass
*oc, const void *data)
             " to upper case) to pass to machine loader, boot manager,"
             " and guest kernel");

-    object_class_property_add(oc, "boot-certs", "BootCertificatesList",
-                              machine_get_boot_certs,
machine_set_boot_certs, NULL, NULL);
+    object_class_property_add_qapi(oc, "boot-certs",
+                                   &BootCertificatesList_type_info,
+                                   machine_get_boot_certs,
+                                   machine_set_boot_certs, NULL, NULL);
     object_class_property_set_description(oc, "boot-certs",
             "provide paths to a directory and/or a certificate file
for secure boot");

>
> There's also a temporary test breakage in PATCH 15.  Could you have a
> look?

It needs a temporary non-QAPI local enum fixes, to set masked_name to
some value.

Or simply rebase "hw/gpio/pca955x: use QAPI enums" & "hw/i386: convert
PCSouthBridgeOption to QAPI enum" before that patch.
Re: [RFC PATCH 0/6] qapi: Preliminary work for better QOM introspection
Posted by Markus Armbruster 3 days, 11 hours ago
Thanks!  I intend to post a v6 of your "qom/qdev: associate properties
with QAPI schema types" today, then continue review there.