From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>
Cc: 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 00/48] hw: resolve QOM type conflicts in multi-target builds
Date: Fri, 13 Nov 2026 12:19:55 +0000 [thread overview]
Message-ID: <avcAa4U_QIu5NVQu@redhat.com> (raw)
In-Reply-To: <CAE2XoE8OvtmLOx9LqmL=aOu2ptu0UpFGYwOdU5YHQ3N=9e1rpg@mail.gmail.com>
On Thu, Nov 12, 2026 at 11:08:02PM +0800, Yonggang Luo wrote:
> On Thu, Nov 12, 2026 at 9:31 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > When building a multi-target binary, QOM types from multiple targets
> > will be linked together. QOM types are required to have unique names
> > when registered, so linking multiple targets in turn requires QOM type
> > names to be unique across the QEMU codebase.
> >
> > Global QOM type name uniqueness is a desirable property for QEMU
> > regardless of multi-target work, so that QEMU presents a non-ambiguous
> > object model to applications regardless of context.
> >
> > In a multi-target binary, it is desirable to applications are able to
> > introspect all types linked into QEMU, when launching with '-machine
> > none'. Dynamic filtering of registered classes at runtime, to resolving
> > QOM naming conflicts is undesirable, as it requires introspection
> > to be repeated for each available target in order to discover the full
> > set of available types in a binary.
> >
> > Introspection is a fairly heavy weight process due to QEMU's vast size,
> > so enabling introspection to be done once only for all targets will be a
> > very significant benefit for management applications with a multi-target
> > binary.
> >
> > The glaring problem is that our historical design has led to multiple
> > targets all providing a 'virt' machine type, which leads to multiple QOM
> > types call 'virt-machine' which are all different.
> >
> > Having a common short name "virt" is a useful characteristic for users,
> > but this does not imply we need to use that as the basis for primary QOM
> > typename. It is sufficient to have an alias called 'virt'.
> >
> > In terms of implementation there are two core pieces
> >
> > * An 'Aliased' interface which can be implemented by QOM types which
> > want to support type aliases.
> >
> > * A 'TargetSpecific' interface which can be implemented by QOM types
> > which want to declare they can only be used with a subset of targets.
> >
> > With those foundational pieces
> >
> > * Machine implements Aliased and TargetSpecific
> >
> > * query-machines reports multiple aliases and declared supported
> > targets per machine for introspection
> >
> > * All the 'virt' machines are renamed to $target-virt, and aliases
> > added for the shorter 'virt' names to retain compatibility and
> > convenience when a target is selected
> >
> > * All the machines which have 'is_available' set now report their
> > targets via the TargetSpecific interface
> >
> > * Creating machines validates declared targets from TargetSpecific
> >
> > An apparent design mistake in TYPE_ACCEL_CPU is resolved which allows
>
> Target independent TYPE_ACCEL_CPU is my first choice, if the QOM name is
> do not have to be kept, I think this is better.
>
> > removal of the is_available hooks from target specific CPU impls, which
> > were working around the bug.
> >
> > The original proposed patches to unconditionally register some object
> > properties is pulled in.
> >
> > Overall this brings us closer to having a single unified object model
> > across all targets, without having to make runtime variations of what
> > is exposed/reported by a given QOM class name.
>
>
> Thanks, overall looks good to me.
>
> hw/microblaze: defer PetaLogix endianness default until init:
> https://lore.kernel.org/qemu-devel/20261105194958.1117-5-luoyonggang@gmail.com/
>
> is also for avoid target_info in class_init
I added a R-B to that.
> The last gap is how to handling cpu class name conflict
> target/arm: register separate max-v8 CPU types for arm and aarch64:
> https://lore.kernel.org/qemu-devel/20261031164009.2048-7-luoyonggang@gmail.com/
I had a look at your earlier proposal here:
https://lore.kernel.org/qemu-devel/20261013195606.152-1-luoyonggang@gmail.com/
and to me that looks like it should do what we need.
* In existing qemu-system-arm and qemu-system-aarch64 it will
"just work"
* In qemu-system-aarch64, users can still opt-in to 32-bit
mode only by using "-cpu max-v8:aarch64=off"
So based on Peter's comment it does not look like we need to
have the ability to register two distnict "max-v8" CPU classes,
a single class can do the right thing at runtime in its
instance constructor.
I see Pierrick commented that it would not work in multi-target:
https://lore.kernel.org/qemu-devel/f3649d73-1edf-440a-9534-7b00da4d075d@oss.qualcomm.com/
I'm not understanding why that is ? The choice of 32-bit vs 64-bit
is made at Object initialization time, so if the
if (target_aarch64()) {
...
condition is not sufficient, it seems like we could add more logic
to that condition easily and to make it do the right thing at runtime.
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 :|
prev parent reply other threads:[~2026-11-13 12:20 UTC|newest]
Thread overview: 58+ 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-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-12 13:30 ` [PATCH 04/48] qom: define an Aliased interface Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 05/48] hw: tweak approach to setting alias in machine macros Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 06/48] hw/core: implement TYPE_ALIASED interface in machines Daniel P. Berrangé
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-12 13:30 ` [PATCH 08/48] system: report multiple machine aliases in help output Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 09/48] system: increase space for machine name in '-machine help' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 10/48] system: resolve multiple aliases when creating machines Daniel P. Berrangé
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-12 13:30 ` [PATCH 12/48] hw/arm: convert machines to use AliasedClass interface Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 13/48] hw/avr: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 14/48] hw/hexagon: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 15/48] hw/i386: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 16/48] hw/loongarch: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 17/48] hw/m68k: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 18/48] hw/ppc: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 19/48] hw/s390x: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 20/48] include/hw: convert machine docs " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 21/48] hw: drop 'alias' field from MachineClass Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 22/48] hw/arm: rename the 'virt' machines to 'arm-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 23/48] hw/riscv: rename the 'virt' machines to 'riscv-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 24/48] hw/hexagon: rename the 'virt' machine to 'hexagon-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 25/48] hw/loongarch: rename the 'virt' machine to 'loongarch-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 26/48] hw/m68k: rename the 'virt' machine to 'm68k-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 27/48] hw/or1k: rename the 'virt' machine to 'or1k-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 28/48] hw/xtensa: rename the 'virt' machine to 'xtensa-virt' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 29/48] system: stop sorting machine names based on 'family' Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 30/48] system: put machine aliases in alphbetical order Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 31/48] system: filter machine type list if a target is selected Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 32/48] hw/core: " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 33/48] system: filter machines based on target during creation Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 34/48] hw/core: implement TYPE_TARGET_SPECIFIC for machine 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-12 13:30 ` [PATCH 36/48] hw/arm: declare arm machine targets 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-12 13:30 ` [PATCH 42/48] Revert "multi-target: restrict whpx-accel-*-cpu to matching target" Daniel P. Berrangé
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-12 13:30 ` [PATCH 44/48] Revert "target/riscv/tcg: restrict tcg-accel-riscv-cpu " Daniel P. Berrangé
2026-11-12 13:30 ` [PATCH 45/48] qom: drop the 'is_available' callback from TypeInfo Daniel P. Berrangé
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é [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=avcAa4U_QIu5NVQu@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--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.