From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>
Cc: "Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
qemu-devel@nongnu.org, "Chao Liu" <chao.liu@processmission.com>,
"Eric Blake" <eblake@redhat.com>,
qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Brian Cain" <brian.cain@oss.qualcomm.com>,
"Stafford Horne" <shorne@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
qemu-riscv@nongnu.org, "Laurent Vivier" <lvivier@redhat.com>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Song Gao" <17746591750@163.com>,
"Philippe Mathieu-Daude" <philmd@mailo.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Weiwei Li" <liwei1518@gmail.com>,
"Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH v3 01/10] machine: allow -M name to differ from QOM type
Date: Fri, 2 Oct 2026 17:17:28 +0100 [thread overview]
Message-ID: <ar_ZGHRkxZKWULPB@redhat.com> (raw)
In-Reply-To: <CAE2XoE8MriyEEeRF3uDwWgnJWPHBieK_-pD1+k0tUjROWjDpWg@mail.gmail.com>
On Fri, Oct 02, 2026 at 10:00:24AM +0800, Yonggang Luo wrote:
> On Fri, Oct 2, 2026 at 2:56 AM Pierrick Bouvier
> <pierrick.bouvier@oss.qualcomm.com> wrote:
> >
> > On 10/1/2026 11:26 AM, Daniel P. Berrangé wrote:
> > > On Thu, Oct 01, 2026 at 11:08:17AM -0700, Pierrick Bouvier wrote:
> > >> On 10/1/2026 10:40 AM, Daniel P. Berrangé wrote:
> > >>> Even with the current per-target binaries there are countless
> > >>> devices linked in which are incompatible / not usable with
> > >>> certain machine types. A new multi-target binary with a union
> > >>> of all devices will just be a bigger example of a scenario that
> > >>> already has to be dealt with for today's binaries.
> > >>>
> > >>> So if we have that assumption that we don't need to do device
> > >>> filtering, at that point, a --target option doesn't have as
> > >>> big of a role to play. The machine type code knows what target(s)
> > >>> it wants (1 or 2 targets depending on if there are 32 + 64 bit
> > >>> varaints. The CPU model the user requests (if the CPU is not
> > >>> hardcoded by the machine), determines 32 bit vs 64 bit.
> > >>>
> > >>
> > >> How can we deduce this information (bitness or target for existing
> > >> machines/cpus)?
> > >
> > > It would require that we introduce a new field in MachineClass
> > > that returned that information about what target a machine is
> > > associated with.
> > >
> > > I note the SysEmuTarget covers both 32-bit and 64-bit variants.
> > >
> > > It might be better use QEMU_ARCH which correlates directly to
> > > the TCG targets, rather than the traditional binary target
> > > names ?
> > >
> > > Likely the CPU class would also want to declare its list of
> > > supported targets.
> > >
> >
> > QEMU_ARCH only represents base architectures, and not variant, so
> > SysEmuTarget is the right choice.
> >
> > So, we would need a list of SysEmuTarget for every cpu/machine that is
> > target specific, since one could be available for variants of base arch?
>
> For this, adding TargetInfo parameter to is_avaible callback will let us get the
> list of SysEmuTarget for every cpu/machine. As we can iterate on all TargetInfo
> then check if that TargetInfo is present for every cpu/machine.
> And indeed for devices if you want. That's what my patches are already done.
>
> And also I have an idea about the set is_avaiable in an easy way. As
> QOM basically
> is a TREE, so for example x86_32 and x86_64 can share a same "i386"
> base, all children's
> is_avaiable inherent from parents is_avaiable, we can ensure every QOM
> object have a
> is_avaiable by update children is_avaiable from parents one.
>
> >
> > @Yonggang: can you try to provide a RFC based on this, to see what it
> > could look like? No need to cover all machines/cpus, just select one of
> > machine+cpu, ideally with multiple SysEmuTarget (like virt and max cpu
> > for aarch64), and let's iterate from this.
> >
> > @Daniel: how do we deal with machines available for all targets like
> > null? We would need a way to ensure all machines/cpus are tagged
> > correctly, in an independent way from "available for all", without
> > having to repeat all existing SysEmuTarget.
> >
> > >> Also, how to deal with devices that are only available for some targets,
> > >> but not others, depending on various Kconfig knobs?
> > >
> > > IMHO just leave devices to raise an error when passed to '-device'
> > > if not compatible with the requested machine.
> > >
> > > eg this example from x86 world:
> > >
> > > $ qemu-system-x86_64 -M microvm -device xen-disk
> > > qemu-system-x86_64: -device xen-disk: No 'xen-bus' bus found for device 'xen-disk'
> > >
> > > $ qemu-system-x86_64 -M isapc -device virtio-net-pci
> > > qemu-system-x86_64: -device virtio-net-pci: No 'PCI' bus found for device 'virtio-net-pci'
> > >
> > > Hopefully most devices have sane error reporting when they
> > > find a dependancy they have is not satisfied by the machine,
> > > but if some end up asserting with crashes that's not a
> > > blocker. Those asserts can be turned into pretty error
> > > messages at our leisure by whomever cares about improving
> > > error diagnosis.
> > >
> >
> > Fine for me. I am a bit skeptical this will be possible to catch all
> > issues, but let's try!
> >
> > So, for existing binary: -M virt works as before.
> >
> > For new multi binary:
> > $ qemu-system -M virt:
> > Multiple machines were found, select one among:
> > - aarch64-virt
> > - riscv64-virt
>
> This would be very hard, that means QOM must be initialized. but we need
> ensure the target is selected before the QOM init.
We don't need to have initialized anything. We just need a single
global variable, whose default initializer is true vs false, for
for the separate vs multi-target binaries. That's just a pair of
.o files with a single bool variable, that we choose between when
linking.
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-10-02 16:19 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 8:15 [PATCH v3 00/10] machine: uniquify virt QOM names Yonggang Luo
2026-09-26 8:15 ` [PATCH v3 01/10] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-30 8:44 ` Zhao Liu
2026-09-30 18:19 ` Pierrick Bouvier
2026-10-01 1:55 ` Yonggang Luo
2026-10-01 4:23 ` Pierrick Bouvier
2026-10-01 8:01 ` Daniel P. Berrangé
2026-10-01 8:13 ` Yonggang Luo
2026-10-01 8:44 ` Philippe Mathieu-Daudé
2026-10-01 10:33 ` Yonggang Luo
2026-10-01 16:14 ` Yonggang Luo
2026-10-01 16:19 ` Pierrick Bouvier
2026-10-01 17:40 ` Daniel P. Berrangé
2026-10-01 18:08 ` Pierrick Bouvier
2026-10-01 18:26 ` Daniel P. Berrangé
2026-10-01 18:56 ` Pierrick Bouvier
2026-10-02 2:00 ` Yonggang Luo
2026-10-02 15:40 ` Pierrick Bouvier
2026-10-02 16:32 ` Daniel P. Berrangé
2026-10-02 16:43 ` Yonggang Luo
2026-10-02 16:52 ` Daniel P. Berrangé
2026-10-02 16:58 ` Yonggang Luo
2026-10-02 16:17 ` Daniel P. Berrangé [this message]
2026-10-02 16:29 ` Yonggang Luo
2026-10-02 3:10 ` Yonggang Luo
2026-10-02 15:34 ` Yonggang Luo
2026-10-02 16:14 ` Daniel P. Berrangé
2026-10-02 16:27 ` Yonggang Luo
2026-10-02 16:34 ` Daniel P. Berrangé
2026-10-03 18:29 ` Yonggang Luo
2026-10-01 2:07 ` Yonggang Luo
2026-09-26 8:15 ` [PATCH v3 02/10] hw/riscv/virt: use unique QOM name Yonggang Luo
2026-09-30 8:44 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 03/10] hw/arm/virt: " Yonggang Luo
2026-09-30 8:44 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 04/10] hw/or1k/virt: " Yonggang Luo
2026-09-30 8:44 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 05/10] hw/hexagon/virt: " Yonggang Luo
2026-09-30 8:45 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 06/10] hw/loongarch/virt: " Yonggang Luo
2026-09-30 8:45 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 07/10] hw/m68k/virt: " Yonggang Luo
2026-09-30 8:45 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 08/10] hw/xtensa/virt: " Yonggang Luo
2026-09-30 8:46 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 09/10] qapi: return MachineInfo typename from query-machines Yonggang Luo
2026-09-28 6:44 ` Markus Armbruster
2026-09-30 8:46 ` Zhao Liu
2026-09-26 8:15 ` [PATCH v3 10/10] machine: match the versioned virt example to arm virt Yonggang Luo
2026-09-30 8:47 ` Zhao Liu
2026-09-30 2:50 ` [PATCH v3 00/10] machine: uniquify virt QOM names Yonggang Luo
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=ar_ZGHRkxZKWULPB@redhat.com \
--to=berrange@redhat.com \
--cc=17746591750@163.com \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=brian.cain@oss.qualcomm.com \
--cc=chao.liu@processmission.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=laurent@vivier.eu \
--cc=liwei1518@gmail.com \
--cc=luoyonggang@gmail.com \
--cc=lvivier@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@mailo.com \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=shorne@gmail.com \
--cc=zhao1.liu@intel.com \
/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.