Re: [PATCH 10/12] target-info: add -target and program-name selection

Daniel P. Berrangé <[email protected]>
Newsgroups org.nongnu.qemu-riscv,org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
On Sun, Aug 23, 2026 at 11:07:28PM +0800, Yonggang Luo wrote:
> - Parse -target before TargetInfo is fixed; CLI overrides the program
>   basename.
> - Tokens are target_name or target_name-be / -le; -target help lists
>   registered names in sorted order.
> - When -target is omitted, infer the token from g_get_prgname(): strip
>   .exe, take the longest dash-separated registered suffix, and retry
>   without a trailing w for Windows GUI binaries.
> - A basename that matches no registered token falls through to the
>   unique default. Combined binaries with no suffix require -target
>   when more than one default TargetInfo is registered.

IMHO this -target argument and the target interference from
program name is a mistaken direction.  We're being led off
course by the attempt to make the new qemu-system be identical
to qemu-system-$TARGET.

If we ignore historical compat and treat qemu-system as a
clean break, then I'd suggest that 'target' is not a concept
to be exposed to the user at all.

The user cares about the machine (and CPUs) they want to run,
and their choice in this respect is what should determine the
target(s) QEMU needs to enable. We should take

  qemu-system --machine vexpress-a15

that tells us we need the arm target. If we need to distinguish
arm7 vs aarch64, then the choice of -cpu should determine 32
bs 64 bit.

This extends better into the future world where we have
machine type that could involve CPUs from multiple targets.

IOW machine config option / QOM class is what we should pivot
off rather than a global target config option.

This likely implies that the MachineClass should gain a class
method to query the QEMU_ARCH_XXXX bitmask required. Initially
restricted to only a single target, so you can wire that through
to the current global target info at startup. Later expanded to
support multiple concurrent targets.
 
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 :|
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.