From: "Daniel P. Berrangé" <berrange@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: "Yonggang Luo" <luoyonggang@gmail.com>,
qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH 04/48] qom: define an Aliased interface
Date: Mon, 16 Nov 2026 21:53:46 +0000 [thread overview]
Message-ID: <avt7apWvO-6QwI_u@redhat.com> (raw)
In-Reply-To: <1447ca17-52a6-c069-d3b0-f778c60dca20@eik.bme.hu>
On Sun, Nov 15, 2026 at 04:31:01PM +0100, BALATON Zoltan wrote:
> On Sun, 15 Nov 2026, Yonggang Luo wrote:
> > On Thu, Nov 12, 2026 at 9:31 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> > >
> > > All QOM types must have a globally unique typename, however, for
> > > user convenience, some might also want to have aliases which are
> > > permitted to be ambiguous. Define an "Aliased" interface which
> > > can be implemented by types which want to support aliases.
> > >
> > > When resolving an alias, if there are multiple QOM types with a
> > > matching alias this is considered an error. Ambiguity can be
> > > resolved by matching system state, with the selected target
> > > being the currently implemented filter.
> > >
> > > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > > ---
> > > include/qom/object_interfaces.h | 77 +++++++++++++++++++++++++++++++++
> > > qom/object_interfaces.c | 57 ++++++++++++++++++++++++
> > > 2 files changed, 134 insertions(+)
> > >
> > > diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
> > > index d222a3d7481..010e37d63f7 100644
> > > --- a/include/qom/object_interfaces.h
> > > +++ b/include/qom/object_interfaces.h
> > > @@ -27,6 +27,17 @@ DECLARE_CLASS_CHECKERS(TargetSpecificClass, TARGET_SPECIFIC,
> > >
> > > typedef struct TargetSpecific TargetSpecific;
> > >
> > > +#define TYPE_ALIASED "aliased"
> > > +
> > > +typedef struct AliasedClass AliasedClass;
> > > +DECLARE_CLASS_CHECKERS(AliasedClass, ALIASED,
> > > + TYPE_ALIASED)
> > > +#define ALIASED(obj) \
> > > + INTERFACE_CHECK(Aliased, (obj), \
> > > + TYPE_ALIASED)
> > > +
> > > +typedef struct Aliased Aliased;
>
> I wonder if it would be simpler to add the possibility to define aliases to
> all QOM objects as standard instead of by an interface? This is useful for
> other cases, it came up here too for example:
> https://lists.nongnu.org/archive/html/qemu-ppc/2025-02/msg00113.html
> Or maybe this could be done with this interface by common super classes
> implementing it such as device and machine allowing aliases that commonly
> need it to use it but then it would be quite widespread use to consider just
> adding it to object right away which may also help interaction with arch.
> Why separating it into an interface is better when we need it for most
> objects?
We really don't need it for most objects. It is somewhat common for
machine classes, just because we have many called 'virt', but even
they are a minority of all machines. The number of places we might
need it outside of machines will likely not exceed single digits.
The core QOM framework tries to be a fairly "pure" object model
without QEMU specific aspects to its design. It is somewhat
inspired by GObject, and I still rather regret that QEMU is not
using GObject as it would have done everything we need and made
life easier.
Stuff that starts to get QEMU specific is pushed into interfaces
like UserCreatable, or abstract base classes like "Device". IMHO
it is beneficial to retain this conceptual division, as it lets
us understand the behaviour of QOM as a framework in isolation
from the bulk of QEMU.
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-11-16 21:54 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 13:30 [PATCH 00/48] hw: resolve QOM type conflicts in multi-target builds Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 01/48] iotests: better heuristics to find I/O tests build/source dirs Daniel P. Berrangé
2026-11-16 20:28 ` Pierrick Bouvier
2026-11-16 20:36 ` Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 02/48] target-info: add target_mask_selected() Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 03/48] qom: define a TargetSpecific interface Daniel P. Berrangé
2026-11-16 20:36 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 04/48] qom: define an Aliased interface Daniel P. Berrangé
2026-11-15 12:36 ` Yonggang Luo
2026-11-15 15:31 ` BALATON Zoltan
2026-11-16 21:53 ` Daniel P. Berrangé [this message]
2026-11-16 22:05 ` Pierrick Bouvier
2026-11-16 23:05 ` BALATON Zoltan
2026-11-16 21:45 ` Daniel P. Berrangé
2026-11-16 20:41 ` Pierrick Bouvier
2026-11-16 20:51 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 05/48] hw: tweak approach to setting alias in machine macros Daniel P. Berrangé
2026-11-16 20:46 ` Pierrick Bouvier
2026-11-16 21:36 ` Daniel P. Berrangé
2026-11-16 21:49 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 06/48] hw/core: implement TYPE_ALIASED interface in machines Daniel P. Berrangé
2026-11-16 20:48 ` Pierrick Bouvier
2026-11-16 21:40 ` Daniel P. Berrangé
2026-11-16 21:49 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 07/48] qapi: report multiple aliases in MachineInfo Daniel P. Berrangé
2026-11-13 7:41 ` Markus Armbruster
2026-11-13 9:31 ` Daniel P. Berrangé
2026-11-13 10:21 ` Markus Armbruster
2026-11-16 20:53 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 08/48] system: report multiple machine aliases in help output Daniel P. Berrangé
2026-11-16 20:54 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 09/48] system: increase space for machine name in '-machine help' Daniel P. Berrangé
2026-11-16 20:54 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 10/48] system: resolve multiple aliases when creating machines Daniel P. Berrangé
2026-11-16 20:57 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 11/48] qapi: deprecate 'alias' field in MachineInfo Daniel P. Berrangé
2026-11-13 7:51 ` Markus Armbruster
2026-11-16 20:58 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 12/48] hw/arm: convert machines to use AliasedClass interface Daniel P. Berrangé
2026-11-16 21:16 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 13/48] hw/avr: " Daniel P. Berrangé
2026-11-16 21:16 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 14/48] hw/hexagon: " Daniel P. Berrangé
2026-11-16 21:16 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 15/48] hw/i386: " Daniel P. Berrangé
2026-11-16 21:16 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 16/48] hw/loongarch: " Daniel P. Berrangé
2026-11-16 21:16 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 17/48] hw/m68k: " Daniel P. Berrangé
2026-11-16 21:17 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 18/48] hw/ppc: " Daniel P. Berrangé
2026-11-16 21:17 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 19/48] hw/s390x: " Daniel P. Berrangé
2026-11-16 21:17 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 20/48] include/hw: convert machine docs " Daniel P. Berrangé
2026-11-16 21:17 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 21/48] hw: drop 'alias' field from MachineClass Daniel P. Berrangé
2026-11-16 21:18 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 22/48] hw/arm: rename the 'virt' machines to 'arm-virt' Daniel P. Berrangé
2026-11-16 21:19 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 23/48] hw/riscv: rename the 'virt' machines to 'riscv-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 24/48] hw/hexagon: rename the 'virt' machine to 'hexagon-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 25/48] hw/loongarch: rename the 'virt' machine to 'loongarch-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 26/48] hw/m68k: rename the 'virt' machine to 'm68k-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 27/48] hw/or1k: rename the 'virt' machine to 'or1k-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 28/48] hw/xtensa: rename the 'virt' machine to 'xtensa-virt' Daniel P. Berrangé
2026-11-16 21:20 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 29/48] system: stop sorting machine names based on 'family' Daniel P. Berrangé
2026-11-16 21:21 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 30/48] system: put machine aliases in alphbetical order Daniel P. Berrangé
2026-11-16 21:22 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 31/48] system: filter machine type list if a target is selected Daniel P. Berrangé
2026-11-16 21:23 ` Pierrick Bouvier
2026-11-16 21:24 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 32/48] hw/core: " Daniel P. Berrangé
2026-11-16 21:24 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 33/48] system: filter machines based on target during creation Daniel P. Berrangé
2026-11-16 21:24 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 34/48] hw/core: implement TYPE_TARGET_SPECIFIC for machine Daniel P. Berrangé
2026-11-16 21:25 ` Pierrick Bouvier
2026-11-16 21:25 ` Pierrick Bouvier
2026-11-16 21:32 ` Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 35/48] qapi: report target compatibility for machine types Daniel P. Berrangé
2026-11-13 7:53 ` Markus Armbruster
2026-11-13 9:36 ` Daniel P. Berrangé
2026-11-13 10:41 ` Markus Armbruster
2026-11-16 21:30 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 36/48] hw/arm: declare arm machine targets Daniel P. Berrangé
2026-11-16 21:42 ` Pierrick Bouvier
2026-11-16 21:43 ` Pierrick Bouvier
2026-11-16 21:55 ` Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 37/48] hw/hexagon: declare hexagon machine target Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 38/48] hw/m68k: declare m68k " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 39/48] hw/or1k: declare or1k " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 40/48] hw/riscv: declare riscv " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 41/48] accel: make TYPE_ACCEL_CPU name target independent Daniel P. Berrangé
2026-11-16 21:43 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 42/48] Revert "multi-target: restrict whpx-accel-*-cpu to matching target" Daniel P. Berrangé
2026-11-16 21:44 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 43/48] Revert "target/riscv/kvm: restrict kvm-accel-riscv-cpu to riscv targets" Daniel P. Berrangé
2026-11-16 21:44 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 44/48] Revert "target/riscv/tcg: restrict tcg-accel-riscv-cpu " Daniel P. Berrangé
2026-11-16 21:44 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 45/48] qom: drop the 'is_available' callback from TypeInfo Daniel P. Berrangé
2026-11-16 21:44 ` Pierrick Bouvier
2026-11-12 13:30 ` [PATCH 46/48] hw/pci: unconditionally expose the 'loadparm' property Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 47/48] hw/scsi: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 48/48] hw/virtio/virtio-mem: unconditionally expose 'unplugged-inaccessible' Daniel P. Berrangé
2026-11-12 15:08 ` [PATCH 00/48] hw: resolve QOM type conflicts in multi-target builds Yonggang Luo
2026-11-13 12:19 ` Daniel P. Berrangé
2026-11-16 21:46 ` Pierrick Bouvier
2026-11-13 13:43 ` Daniel P. Berrangé
2026-11-16 1:57 ` Pierrick Bouvier
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=avt7apWvO-6QwI_u@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=luoyonggang@gmail.com \
--cc=philmd@oss.qualcomm.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.