All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: luoyonggang@gmail.com, qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
Date: Wed, 7 Oct 2026 15:52:41 +0100	[thread overview]
Message-ID: <asZcuW82odzLVZ_l@redhat.com> (raw)
In-Reply-To: <52b6baff-e692-4379-a724-3e9ae968110c@oss.qualcomm.com>

On Wed, Oct 07, 2026 at 07:28:59AM -0700, Pierrick Bouvier wrote:
> On 10/7/2026 12:48 AM, Yonggang Luo wrote:
> > On Wed, Oct 7, 2026 at 12:03 PM Pierrick Bouvier
> > <pierrick.bouvier@oss.qualcomm.com> wrote:
> >>
> >> For now, TARGET_ARCH only contains 32 vs 64 bit arch. The variants,
> >> based on endianness, are accessible through TARGET_NAME. However,
> >> TARGET_NAME is a string, and thus can't be concatenated to generate code
> >> and retrieve matching SYS_EMU_TARGET enum entry.
> >> Thus, export this information in TARGET_ARCH_VARIANT as an unquoted
> >> identifier.
> >>
> >> There is one more subtlety, user binaries have extra targets that are
> >> not present in SYS_EMU_TARGET, like armeb.
> >> Thus, for user binaries, simply export TARGET_ARCH.
> > 
> > 
> >>
> >> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> >> ---
> >>  meson.build | 11 +++++++++--
> >>  1 file changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/meson.build b/meson.build
> >> index cae1591cd28..9bcfe84daba 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -3288,7 +3288,14 @@ default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
> >>  actual_target_dirs = []
> >>  fdt_required = []
> >>  foreach target : target_dirs
> >> -  config_target = { 'TARGET_NAME': target.split('-')[0] }
> >> +  target_name = target.split('-')[0]
> >> +  config_target = { 'TARGET_NAME': target_name }
> >> +  if target.endswith('linux-user')
> >> +    config_target += { 'TARGET_ARCH_VARIANT': 'TARGET_ARCH' }
> > 
> > If TARGET_ARCH_VARIANT or just called (TARGET_NAME_ENUM) is just a
> > direct mapping of target_name regardless linux-user/bsd-user/softmmu,
> > the logic would
> > be simpler. That would need add more enum to SYS_EMU_TARGET, the
> > current form is:
> > ##
> > # @SysEmuTarget:
> > #     The comprehensive enumeration of QEMU system emulation
> > #     ("softmmu") targets.  Run "./configure --help" in the project
> > #     root directory, and look for the \*-softmmu targets near the
> > #     "--target-list" option.  The individual target constants are not
> > #     documented here, for the time being.
> > #
> > # @rx: since 5.0
> > #
> > # @avr: since 5.1
> > #
> > # @loongarch64: since 7.1
> > #
> > # @hexagon: since 11.0
> > #
> > # .. note:: The resulting QMP strings can be appended to the
> > #    "qemu-system-" prefix to produce the corresponding QEMU
> > #    executable name.  This is true even for "qemu-system-x86_64".
> > #
> > # Since: 3.0
> > ##
> > { 'enum' : 'SysEmuTarget',
> >   'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'hexagon', 'hppa', 'i386',
> >              'loongarch64', 'm68k', 'microblaze', 'mips', 'mips64',
> >              'mips64el', 'mipsel', 'or1k', 'ppc',
> >              'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4',
> >              'sh4eb', 'sparc', 'sparc64', 'tricore',
> >              'x86_64', 'xtensa', 'xtensaeb' ] }
> > 
> > 
> > The list target names that missing from SysEmuTarget:
> > 
> > Comparing the target-name prefixes of `configs/targets/*.mak` with the
> > `SysEmuTarget` enum in `qapi/machine.json`, the following seven names are
> > missing. All are Linux-user-only targets.
> > 
> > | Target name | Config |
> > |---|---|
> > | `aarch64_be` | `configs/targets/aarch64_be-linux-user.mak` |
> > | `armeb` | `configs/targets/armeb-linux-user.mak` |
> > | `microblazeel` | `configs/targets/microblazeel-linux-user.mak` |
> > | `mipsn32` | `configs/targets/mipsn32-linux-user.mak` |
> > | `mipsn32el` | `configs/targets/mipsn32el-linux-user.mak` |
> > | `ppc64le` | `configs/targets/ppc64le-linux-user.mak` |
> > | `sparc32plus` | `configs/targets/sparc32plus-linux-user.mak` |
> > 
> > All `*-softmmu` and `*-bsd-user` target names match enum entries.
> > 
> > This comparison uses names derived from config filenames, not the
> > `TARGET_ARCH` values inside those configs.
> > 
> > By doing this I think it would be more consistent.
> > If these target names are removed in future, then just remove it from
> > SysEmuTarget
> > along with. So SysEmuTarget is just a direct mapping of TARGET_NAME. Though
> > The comment of SysEmuTarget needs updated, it's not just about softmmu, but also
> > for linux-user and bsd-user. But the fact is, with the current
> > changes. *-user also
> > used SysEmuTarget as an enum.
> > 
> > 
> > And TARGET_ARCH should also be exported by TargetInfo for other usage.
> > And it's enums is the subset
> > of enum SysEmuTarget
> >
> 
> I tend to agree, but didn't find a real reason to do this change (yet).
> Also, I would be in favor to rename SysEmuTarget since in EmuTarget,
> since it would now be decoupled from system emulation only.
> 
> @Daniel: Would you be favor to see such a change? I know that
> introspection/QAPI is related to system emulation, and I'm not
> completely sure adding user targets is the right move at this moment.

The QAPI type names are purely internal - they're not exposed to
clients of QMP, so we can (and have) renamed the types in the
past.

If SysEmuTarget gains some more enum values that correspond
to linux-user targets, that would be visible when introspecting
the QAPI schema. I don't think that is a problem though - it is
always possible for SysEmuTarget to return a bunch of names, for
which there is no binary. All that matters really is that
query-target returns the right name.

So I think the rename + extra targets is fine.

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 :|



  parent reply	other threads:[~2026-10-07 14:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 18:25 [PATCH 0/2] target-info: expose full target variant Pierrick Bouvier
2026-10-06 18:25 ` [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config Pierrick Bouvier
2026-10-07  5:21   ` Philippe Mathieu-Daudé
2026-10-07  7:09   ` Daniel P. Berrangé
2026-10-07  7:48   ` Yonggang Luo
2026-10-07 14:28     ` Pierrick Bouvier
2026-10-07 14:47       ` Yonggang Luo
2026-10-07 16:09         ` Pierrick Bouvier
2026-10-07 14:52       ` Daniel P. Berrangé [this message]
2026-10-07  9:27   ` Yonggang Luo
2026-10-07 14:32     ` Pierrick Bouvier
2026-10-06 18:25 ` [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT Pierrick Bouvier
2026-10-07  5:21   ` Philippe Mathieu-Daudé
2026-10-07  7:10   ` Daniel P. Berrangé

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=asZcuW82odzLVZ_l@redhat.com \
    --to=berrange@redhat.com \
    --cc=luoyonggang@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.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.