All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>
Subject: Re: [PATCH v2 01/53] qapi: add QAPITypeInfo struct definition
Date: Fri, 31 Jul 2026 13:43:00 +0200	[thread overview]
Message-ID: <87mrv78jwb.fsf@pond.sub.org> (raw)
In-Reply-To: <20260616-qom-qapi-v2-1-cc9396b9c18c@redhat.com> ("Marc-André Lureau"'s message of "Tue, 16 Jun 2026 00:37:27 +0400")

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Introduce a minimal struct that pairs a QAPI type's internal name with
> its "masked" introspection name. Generated constants of this type will
> let QOM property registration carry a reliable reference to the QAPI
> schema and possibly other associated data.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/qapi/qapi-type-info.h | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/include/qapi/qapi-type-info.h b/include/qapi/qapi-type-info.h
> new file mode 100644
> index 00000000000..a7a470af731
> --- /dev/null
> +++ b/include/qapi/qapi-type-info.h
> @@ -0,0 +1,32 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef QAPI_TYPE_INFO_H
> +#define QAPI_TYPE_INFO_H
> +
> +#include "qapi/util.h"
> +
> +/**
> + * QAPITypeInfo - QAPI type metadata
> + *
> + * @name: QAPI type name (e.g. "str", "OnOffAuto", "int32List").
> + *        QOM uses this as the property type string.
> + * @schema_name: Name of the type in the QAPI introspection schema, assigned by
> + *        scripts/qapi/introspect.py (e.g. "368"). NULL for builtin types not
> + *        individually present in the schema.

"Schema" is ambiguous here: there's the QAPI schema
(e.g. qapi/qapi-schema.json and its sub-modules), and the SchemaInfo
returned by query-qmp-schema.  Could well lead to confusion.

What about @masked_name?

> + * @lookup: QEnumLookup for this type, or NULL for non-enum types.
> + *        visit_type_enum(), qapi_enum_parse(), and qapi_enum_lookup()
> + *        all rely on it.

Not yet.  Either mention that in the commit message, or add the member
later, when the comment is correct.

> + * @list: The list-type counterpart, or NULL if none exists.
> + *        str_type_info.list points to strList_type_info.  qdev array
> + *        properties follow this to find the list type for their element.

Likewise.

> + */
> +typedef struct QAPITypeInfo {
> +    const char *name;
> +    const char *schema_name;
> +    const QEnumLookup *lookup;
> +    const struct QAPITypeInfo *list;
> +} QAPITypeInfo;
> +
> +#endif /* QAPI_TYPE_INFO_H */

This is somewhat related to SchemaInfo, which is also meta-data about
QAPI types (and also commands and events).

SchemaInfo only has the masked name[*].  It has a reference from array
type to element type instead of the other way round.  Everything else in
QAPITypeInfo is also in SchemaInfo, I believe.

So far, QEMU uses SchemaInfo only around qmp_query_qmp_schema().
qmp_query_qmp_schema() a SchemaInfoList on the fly from something else,
and the QMP core (it's only caller) then converts it via QObject to a
string reply.

Now I need to digress into history a bit.

The value of query-qmp-schema is fixed at compile time.  My initial
version simply generated the fixed reply as string.  Efficient, because
it doesn't build a (bulky!) QObject reply.  Also a bit hacky.

This got in the way of QAPI 'if' conditionals, so commit 7d0f982b
switched to a pointer-less variation of the QObject that can be
generated as data more easily: QLitObject[].  query-qmp-schema converts
this to QObject every time it runs.  The QLitObject[] would be awkward
to use for anything else.

End of digression.

I wonder whether it could make sense to have a single repository of QAPI
type meta data, usable both for query-qmp-schema and for your QOM work.
Something QOM could use about as easily as QAPITypeInfo, and
query-qmp-schema could convert to its reply.

At this time, this is an idea phrased as a question.  Is it a good idea?
I'm not sure.  Even if it is, I'm not sure it should be implemented
right away.  I'm just sharing the idea.


[*] The QAPI generator has an option to make it have only the unmasked
names.  Occasionally convenient when messing around.



  reply	other threads:[~2026-07-31 11:43 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 20:37 [PATCH v2 00/53] qom/qdev: associate properties with QAPI schema types Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 01/53] qapi: add QAPITypeInfo struct definition Marc-André Lureau
2026-07-31 11:43   ` Markus Armbruster [this message]
2026-06-15 20:37 ` [PATCH v2 02/53] qapi/introspect: expose the type name map Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 03/53] qapi: add type-infos generator Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 04/53] qapi/backend: wire up type-infos generation Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 05/53] qapi/gen: fix _module_basename for multi-dash 'what' parameters Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 06/53] meson: add qapi-type-infos-*.c/h to build Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 07/53] qom: add qapi_type field to ObjectProperty Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 08/53] qapi/qom: add qapi-type field to ObjectPropertyInfo Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 09/53] qom/qmp: populate qapi-type in QMP handlers Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 10/53] qom: add QAPI-aware property registration Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 11/53] tests: update check-qom-proplist for " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 12/53] qom: convert enum properties to QAPI-aware registration Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 13/53] qom: remove old enum property registration API Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 14/53] qom: convert struct properties to QAPI-aware registration Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 15/53] " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 16/53] x86: convert OnOffAuto " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 17/53] microvm: " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 18/53] pc: convert OnOffAuto vmport property " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 19/53] arm/virt: convert OnOffAuto acpi " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 20/53] riscv/virt: convert OnOffAuto properties " Marc-André Lureau
2026-06-16  0:53   ` Alistair Francis
2026-06-15 20:37 ` [PATCH v2 21/53] loongarch/virt: " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 22/53] hostmem-file: convert OnOffAuto rom property " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 23/53] sev: convert OnOffAuto legacy-vm-type " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 24/53] whpx: convert OnOffAuto hyperv " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 25/53] whpx: convert OnOffAuto arch properties " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 26/53] accel/kvm: convert OnOffSplit property " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 27/53] whpx: " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 28/53] ppc/spapr-caps: convert to QAPI-aware property registration Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 29/53] system/memory: fix "priority" property typename Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 30/53] hw/mem/nvdimm: fix "size" " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 31/53] qom: convert scalar properties to QAPI-aware registration Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 32/53] i386/cpu: convert strList property " Marc-André Lureau
2026-06-15 20:37 ` [PATCH v2 33/53] accel/hvf: convert OnOffSplit " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 34/53] i386/x86: convert SgxEPCList " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 35/53] virtio-balloon: convert guest-stats property to QAPI type Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 36/53] qom: replace object_property_add_tm with StructTm " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 37/53] hw/nvdimm: convert UUID property to QAPI-aware registration Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 38/53] hw/s390-virtio-ccw: convert loadparm " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 39/53] hw/ppc/spapr_drc: convert fdt " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 40/53] spdm-socket: convert SpdmTransportType to QAPI enum Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 41/53] hw/pci: change the busnr type to uint8 Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 42/53] qdev: add qapi_type field to PropertyInfo with fallback registration Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 43/53] qdev: convert core PropertyInfo definitions to use qapi_type Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 44/53] qdev: convert system " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 45/53] hw: convert device-local " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 46/53] target/riscv: fix incorrect QAPI types and u8 casting Marc-André Lureau
2026-06-16  0:54   ` Alistair Francis
2026-06-15 20:38 ` [PATCH v2 47/53] target/riscv: convert PropertyInfo definitions to use qapi_type Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 48/53] qdev: " Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 49/53] qdev: introduce typed array PropertyInfos Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 50/53] qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo Marc-André Lureau
2026-07-28  7:35   ` Markus Armbruster
2026-07-28  8:24     ` Markus Armbruster
2026-07-28  8:32       ` Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 51/53] qdev: remove deprecated PropertyInfo.type and .enum_table fields Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 52/53] memory: use object_property_add_link for container property Marc-André Lureau
2026-06-15 20:38 ` [PATCH v2 53/53] qom: use QAPITypeInfo in object_property_get_enum Marc-André Lureau

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=87mrv78jwb.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@mailo.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.