All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] target-info: expose full target variant
@ 2026-10-06 18:25 Pierrick Bouvier
  2026-10-06 18:25 ` [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config Pierrick Bouvier
  2026-10-06 18:25 ` [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT Pierrick Bouvier
  0 siblings, 2 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-06 18:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Marc-André Lureau,
	Pierrick Bouvier, Paolo Bonzini, Daniel P. Berrangé

Recently, a regression was introduced that restricted list of targets returned
by target-info by ignoring endianness variants. As a result, qmp query_target
output changed compared to previous releases.

Fix that by exporting the full variant, and use that to define arch in
target_info, thus giving us back a 1:1 mapping with SYS_EMU_TARGET enum.

Pierrick Bouvier (2):
  meson.build: export TARGET_ARCH_VARIANT in target config
  target-info: use TARGET_ARCH_VARIANT

 meson.build        | 11 +++++++++--
 target-info-stub.c |  2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-06 18:25 [PATCH 0/2] target-info: expose full target variant Pierrick Bouvier
@ 2026-10-06 18:25 ` Pierrick Bouvier
  2026-10-07  5:21   ` Philippe Mathieu-Daudé
                     ` (3 more replies)
  2026-10-06 18:25 ` [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT Pierrick Bouvier
  1 sibling, 4 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-06 18:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Marc-André Lureau,
	Pierrick Bouvier, Paolo Bonzini, Daniel P. Berrangé

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' }
+  else
+    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
+  endif
+
   if target.endswith('linux-user')
     if host_os != 'linux'
       if default_targets
@@ -3372,7 +3379,7 @@ foreach target : target_dirs
       # do nothing
     elif ignored.contains(k)
       # do nothing
-    elif k == 'TARGET_ARCH'
+    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
       config_target_data.set(k, v.to_upper())
     elif k == 'TARGET_BASE_ARCH'
       # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT
  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-06 18:25 ` Pierrick Bouvier
  2026-10-07  5:21   ` Philippe Mathieu-Daudé
  2026-10-07  7:10   ` Daniel P. Berrangé
  1 sibling, 2 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-06 18:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Marc-André Lureau,
	Pierrick Bouvier, Paolo Bonzini, Daniel P. Berrangé

target_arch() will now return the full variant, per SYS_EMU_TARGET enum.

Fixes: e934c624f3 ("target-info: Statically initialize target_arch")
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 target-info-stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-info-stub.c b/target-info-stub.c
index d121b8c0170..b0079d44dcf 100644
--- a/target-info-stub.c
+++ b/target-info-stub.c
@@ -26,7 +26,7 @@ QEMU_BUILD_BUG_ON(TARGET_PAGE_BITS < TARGET_PAGE_BITS_MIN);
 
 static const TargetInfo target_info_stub = {
     .target_name = TARGET_NAME,
-    .target_arch = glue(SYS_EMU_TARGET_, TARGET_ARCH),
+    .target_arch = glue(SYS_EMU_TARGET_, TARGET_ARCH_VARIANT),
     .long_bits = TARGET_LONG_BITS,
     .cpu_type = CPU_RESOLVING_TYPE,
     .endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT
  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é
  1 sibling, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-10-07  5:21 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Marc-André Lureau, Paolo Bonzini, Daniel P. Berrangé

On 6/10/26 20:25, Pierrick Bouvier wrote:
> target_arch() will now return the full variant, per SYS_EMU_TARGET enum.
> 
> Fixes: e934c624f3 ("target-info: Statically initialize target_arch")
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>   target-info-stub.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  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é
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-10-07  5:21 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Marc-André Lureau, Paolo Bonzini, Daniel P. Berrangé

On 6/10/26 20:25, Pierrick Bouvier 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(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  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  9:27   ` Yonggang Luo
  3 siblings, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2026-10-07  7:09 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini

On Tue, Oct 06, 2026 at 06:25:57PM +0000, Pierrick Bouvier 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(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] target-info: use TARGET_ARCH_VARIANT
  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é
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2026-10-07  7:10 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini

On Tue, Oct 06, 2026 at 06:25:58PM +0000, Pierrick Bouvier wrote:
> target_arch() will now return the full variant, per SYS_EMU_TARGET enum.
> 
> Fixes: e934c624f3 ("target-info: Statically initialize target_arch")
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  target-info-stub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  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  9:27   ` Yonggang Luo
  3 siblings, 1 reply; 14+ messages in thread
From: Yonggang Luo @ 2026-10-07  7:48 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

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



> +  else
> +    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
> +  endif
> +
>    if target.endswith('linux-user')
>      if host_os != 'linux'
>        if default_targets
> @@ -3372,7 +3379,7 @@ foreach target : target_dirs
>        # do nothing
>      elif ignored.contains(k)
>        # do nothing
> -    elif k == 'TARGET_ARCH'
> +    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
>        config_target_data.set(k, v.to_upper())
>      elif k == 'TARGET_BASE_ARCH'
>        # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
> --
> 2.43.0
>
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-06 18:25 ` [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config Pierrick Bouvier
                     ` (2 preceding siblings ...)
  2026-10-07  7:48   ` Yonggang Luo
@ 2026-10-07  9:27   ` Yonggang Luo
  2026-10-07 14:32     ` Pierrick Bouvier
  3 siblings, 1 reply; 14+ messages in thread
From: Yonggang Luo @ 2026-10-07  9:27 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

Why not close: https://gitlab.com/qemu-project/qemu/-/work_items/4640,
I'll close that directly.

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' }
> +  else
> +    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
> +  endif
> +
>    if target.endswith('linux-user')
>      if host_os != 'linux'
>        if default_targets
> @@ -3372,7 +3379,7 @@ foreach target : target_dirs
>        # do nothing
>      elif ignored.contains(k)
>        # do nothing
> -    elif k == 'TARGET_ARCH'
> +    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
>        config_target_data.set(k, v.to_upper())
>      elif k == 'TARGET_BASE_ARCH'
>        # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
> --
> 2.43.0
>
>


-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-07  7:48   ` Yonggang Luo
@ 2026-10-07 14:28     ` Pierrick Bouvier
  2026-10-07 14:47       ` Yonggang Luo
  2026-10-07 14:52       ` Daniel P. Berrangé
  0 siblings, 2 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-07 14:28 UTC (permalink / raw)
  To: luoyonggang
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

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.

> 
> 
>> +  else
>> +    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
>> +  endif
>> +
>>    if target.endswith('linux-user')
>>      if host_os != 'linux'
>>        if default_targets
>> @@ -3372,7 +3379,7 @@ foreach target : target_dirs
>>        # do nothing
>>      elif ignored.contains(k)
>>        # do nothing
>> -    elif k == 'TARGET_ARCH'
>> +    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
>>        config_target_data.set(k, v.to_upper())
>>      elif k == 'TARGET_BASE_ARCH'
>>        # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
>> --
>> 2.43.0
>>
>>
> 
> 
> --
>          此致
> 礼
> 罗勇刚
> Yours
>     sincerely,
> Yonggang Luo



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-07  9:27   ` Yonggang Luo
@ 2026-10-07 14:32     ` Pierrick Bouvier
  0 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-07 14:32 UTC (permalink / raw)
  To: luoyonggang
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

On 10/7/2026 2:27 AM, Yonggang Luo wrote:
> Why not close: https://gitlab.com/qemu-project/qemu/-/work_items/4640,
> I'll close that directly.
>

Thanks, I didn't see this work item.
Even though it's closed, I'll add the fixed tag to current commit.

Thanks,
Pierrick


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  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é
  1 sibling, 1 reply; 14+ messages in thread
From: Yonggang Luo @ 2026-10-07 14:47 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

On Wed, Oct 7, 2026 at 10:29 PM Pierrick Bouvier
<pierrick.bouvier@oss.qualcomm.com> 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.

I think the current patch is enough at the current stage.

A better bsd-user/linux-user support needs much more work.
for example:

enum {
    QEMU_ARCH_ALPHA =       (1UL << SYS_EMU_TARGET_ALPHA),
    QEMU_ARCH_ARM =         (1UL << SYS_EMU_TARGET_ARM) |
                            (1UL << SYS_EMU_TARGET_AARCH64),
    QEMU_ARCH_I386 =        (1UL << SYS_EMU_TARGET_I386) |
                            (1UL << SYS_EMU_TARGET_X86_64),
    QEMU_ARCH_M68K =        (1UL << SYS_EMU_TARGET_M68K),
    QEMU_ARCH_MICROBLAZE =  (1UL << SYS_EMU_TARGET_MICROBLAZE),
    QEMU_ARCH_MIPS =        (1UL << SYS_EMU_TARGET_MIPS) |
                            (1UL << SYS_EMU_TARGET_MIPSEL) |
                            (1UL << SYS_EMU_TARGET_MIPS64) |
                            (1UL << SYS_EMU_TARGET_MIPS64EL),
    QEMU_ARCH_PPC =         (1UL << SYS_EMU_TARGET_PPC) |
                            (1UL << SYS_EMU_TARGET_PPC64),
    QEMU_ARCH_S390X =       (1UL << SYS_EMU_TARGET_S390X),
    QEMU_ARCH_SH4 =         (1UL << SYS_EMU_TARGET_SH4) |
                            (1UL << SYS_EMU_TARGET_SH4EB),
    QEMU_ARCH_SPARC =       (1UL << SYS_EMU_TARGET_SPARC) |
                            (1UL << SYS_EMU_TARGET_SPARC64),
    QEMU_ARCH_XTENSA =      (1UL << SYS_EMU_TARGET_XTENSA) |
                            (1UL << SYS_EMU_TARGET_XTENSAEB),
    QEMU_ARCH_OR1K =        (1UL << SYS_EMU_TARGET_OR1K),
    QEMU_ARCH_TRICORE =     (1UL << SYS_EMU_TARGET_TRICORE),
    QEMU_ARCH_HPPA =        (1UL << SYS_EMU_TARGET_HPPA),
    QEMU_ARCH_RISCV =       (1UL << SYS_EMU_TARGET_RISCV32) |
                            (1UL << SYS_EMU_TARGET_RISCV64),
    QEMU_ARCH_RX =          (1UL << SYS_EMU_TARGET_RX),
    QEMU_ARCH_AVR =         (1UL << SYS_EMU_TARGET_AVR),
    QEMU_ARCH_HEXAGON =     (1UL << SYS_EMU_TARGET_HEXAGON),
    QEMU_ARCH_LOONGARCH =   (1UL << SYS_EMU_TARGET_LOONGARCH64),
    QEMU_ARCH_ALL =         UINT32_MAX,
};

QEMU_BUILD_BUG_ON(SYS_EMU_TARGET__MAX > 32);

/**
 * qemu_arch_available:
 * @arch_bitmask: bitmask of QEMU_ARCH_* constants
 *
 * Return whether the current target architecture is contained in @arch_bitmask
 */
bool qemu_arch_available(uint32_t arch_bitmask);

arch_bitmask also needs to be increased to 64bit, and currently
SYS_EMU_TARGET__MAX is 29, very close to 32.


>
> @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.
>
> >
> >
> >> +  else
> >> +    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
> >> +  endif
> >> +
> >>    if target.endswith('linux-user')
> >>      if host_os != 'linux'
> >>        if default_targets
> >> @@ -3372,7 +3379,7 @@ foreach target : target_dirs
> >>        # do nothing
> >>      elif ignored.contains(k)
> >>        # do nothing
> >> -    elif k == 'TARGET_ARCH'
> >> +    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
> >>        config_target_data.set(k, v.to_upper())
> >>      elif k == 'TARGET_BASE_ARCH'
> >>        # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
> >> --
> >> 2.43.0
> >>
> >>
> >
> >
> > --
> >          此致
> > 礼
> > 罗勇刚
> > Yours
> >     sincerely,
> > Yonggang Luo
>


-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-07 14:28     ` Pierrick Bouvier
  2026-10-07 14:47       ` Yonggang Luo
@ 2026-10-07 14:52       ` Daniel P. Berrangé
  1 sibling, 0 replies; 14+ messages in thread
From: Daniel P. Berrangé @ 2026-10-07 14:52 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: luoyonggang, qemu-devel, Philippe Mathieu-Daudé,
	Marc-André Lureau, Paolo Bonzini

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



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] meson.build: export TARGET_ARCH_VARIANT in target config
  2026-10-07 14:47       ` Yonggang Luo
@ 2026-10-07 16:09         ` Pierrick Bouvier
  0 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2026-10-07 16:09 UTC (permalink / raw)
  To: luoyonggang
  Cc: qemu-devel, Philippe Mathieu-Daudé, Marc-André Lureau,
	Paolo Bonzini, Daniel P. Berrangé

On 10/7/2026 7:47 AM, Yonggang Luo wrote:
> On Wed, Oct 7, 2026 at 10:29 PM Pierrick Bouvier
> <pierrick.bouvier@oss.qualcomm.com> 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.
> 
> I think the current patch is enough at the current stage.
>

Agree, the rest is an additional refactoring that belongs to a different
series.

> A better bsd-user/linux-user support needs much more work.
> for example:
> 
> enum {
>     QEMU_ARCH_ALPHA =       (1UL << SYS_EMU_TARGET_ALPHA),
>     QEMU_ARCH_ARM =         (1UL << SYS_EMU_TARGET_ARM) |
>                             (1UL << SYS_EMU_TARGET_AARCH64),
>     QEMU_ARCH_I386 =        (1UL << SYS_EMU_TARGET_I386) |
>                             (1UL << SYS_EMU_TARGET_X86_64),
>     QEMU_ARCH_M68K =        (1UL << SYS_EMU_TARGET_M68K),
>     QEMU_ARCH_MICROBLAZE =  (1UL << SYS_EMU_TARGET_MICROBLAZE),
>     QEMU_ARCH_MIPS =        (1UL << SYS_EMU_TARGET_MIPS) |
>                             (1UL << SYS_EMU_TARGET_MIPSEL) |
>                             (1UL << SYS_EMU_TARGET_MIPS64) |
>                             (1UL << SYS_EMU_TARGET_MIPS64EL),
>     QEMU_ARCH_PPC =         (1UL << SYS_EMU_TARGET_PPC) |
>                             (1UL << SYS_EMU_TARGET_PPC64),
>     QEMU_ARCH_S390X =       (1UL << SYS_EMU_TARGET_S390X),
>     QEMU_ARCH_SH4 =         (1UL << SYS_EMU_TARGET_SH4) |
>                             (1UL << SYS_EMU_TARGET_SH4EB),
>     QEMU_ARCH_SPARC =       (1UL << SYS_EMU_TARGET_SPARC) |
>                             (1UL << SYS_EMU_TARGET_SPARC64),
>     QEMU_ARCH_XTENSA =      (1UL << SYS_EMU_TARGET_XTENSA) |
>                             (1UL << SYS_EMU_TARGET_XTENSAEB),
>     QEMU_ARCH_OR1K =        (1UL << SYS_EMU_TARGET_OR1K),
>     QEMU_ARCH_TRICORE =     (1UL << SYS_EMU_TARGET_TRICORE),
>     QEMU_ARCH_HPPA =        (1UL << SYS_EMU_TARGET_HPPA),
>     QEMU_ARCH_RISCV =       (1UL << SYS_EMU_TARGET_RISCV32) |
>                             (1UL << SYS_EMU_TARGET_RISCV64),
>     QEMU_ARCH_RX =          (1UL << SYS_EMU_TARGET_RX),
>     QEMU_ARCH_AVR =         (1UL << SYS_EMU_TARGET_AVR),
>     QEMU_ARCH_HEXAGON =     (1UL << SYS_EMU_TARGET_HEXAGON),
>     QEMU_ARCH_LOONGARCH =   (1UL << SYS_EMU_TARGET_LOONGARCH64),
>     QEMU_ARCH_ALL =         UINT32_MAX,
> };
> 
> QEMU_BUILD_BUG_ON(SYS_EMU_TARGET__MAX > 32);
> 
> /**
>  * qemu_arch_available:
>  * @arch_bitmask: bitmask of QEMU_ARCH_* constants
>  *
>  * Return whether the current target architecture is contained in @arch_bitmask
>  */
> bool qemu_arch_available(uint32_t arch_bitmask);
> 
> arch_bitmask also needs to be increased to 64bit, and currently
> SYS_EMU_TARGET__MAX is 29, very close to 32.
> 
>

I'll take a look to extend it and do the renaming.

>>
>> @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.
>>
>>>
>>>
>>>> +  else
>>>> +    config_target += { 'TARGET_ARCH_VARIANT': target_name.to_upper() }
>>>> +  endif
>>>> +
>>>>    if target.endswith('linux-user')
>>>>      if host_os != 'linux'
>>>>        if default_targets
>>>> @@ -3372,7 +3379,7 @@ foreach target : target_dirs
>>>>        # do nothing
>>>>      elif ignored.contains(k)
>>>>        # do nothing
>>>> -    elif k == 'TARGET_ARCH'
>>>> +    elif k == 'TARGET_ARCH' or k == 'TARGET_ARCH_VARIANT'
>>>>        config_target_data.set(k, v.to_upper())
>>>>      elif k == 'TARGET_BASE_ARCH'
>>>>        # Note that TARGET_BASE_ARCH ends up in config-target.h but it is
>>>> --
>>>> 2.43.0
>>>>
>>>>
>>>
>>>
>>> --
>>>          此致
>>> 礼
>>> 罗勇刚
>>> Yours
>>>     sincerely,
>>> Yonggang Luo
>>
> 
> 



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-10-07 16:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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é
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é

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.