On Mon, Sep 28, 2026 at 7:34 PM Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> On 28/9/26 12:51, Yonggang Luo wrote:
> > On Mon, Sep 28, 2026 at 6:39 PM Philippe Mathieu-Daudé <
> > [email protected]> wrote:
> >>
> >> On 28/9/26 12:13, Daniel P. Berrangé wrote:
> >>> On Sat, Sep 26, 2026 at 03:00:45PM +0800, Yonggang Luo wrote:
> >>>> query-targets lists each linked target, including none, with its
> >>>> arch, endianness, and the machines that target accepts.
> >>>>
> >>>> Signed-off-by: Yonggang Luo <[email protected]>
> >>>> ---
> >>>>    hw/core/machine-qmp-cmds.c | 30 ++++++++++++++++++++++++++++++
> >>>>    qapi/machine.json          | 35 +++++++++++++++++++++++++++++++++++
> >>>>    2 files changed, 65 insertions(+)
> >>>
> >>>
> >>>> diff --git a/qapi/machine.json b/qapi/machine.json
> >>>> index 6aaa2af709a..d8cdea6203e 100644
> >>>> --- a/qapi/machine.json
> >>>> +++ b/qapi/machine.json
> >>>> @@ -307,6 +307,41 @@
> >>>>    ##
> >>>>    { 'command': 'query-target', 'returns': 'QemuTargetInfo' }
> >>>>
> >>>> +##
> >>>> +# @TargetMachines:
> >>>> +#
> >>>> +# One registered system target and the machines that can run on it.
> >>>> +#
> >>>> +# @arch: the target architecture
> >>>> +#
> >>>> +# @endianness: the target endianness
> >>>> +#
> >>>> +# @machines: machine type names, not aliases
> >>>> +#
> >>>> +# Since: 11.2
> >>>> +##
> >>>> +{ 'struct': 'TargetMachines',
> >>>> +  'data': { 'arch': 'SysEmuTarget',
> >>>> +            'endianness': 'EndianMode',
> >>>> +            'machines': ['str'] } }
> >>>
> >>> We already have  'QemuTargetInfo' struct which is used
> >>> with 'query-target', that should also be used with the
> >>> new 'query-targets' command.
> >>>
> >>> We need to add the 'endianness' field to QemuTargetInfo.
> >>
> >> Why do we want to expose endianness, and what endianness to
> >> expose? Endianness is a runtime bit state of CPUs. Sometime
> >> this bit is hardwired but that is an implementation detail.
> >
> > For some targets it's, but for some targets it's not. for example
> >
> > mips-softmmu.mak
> > mipsel-softmmu.mak
> > mips64el-softmmu.mak
> > mips64-softmmu.mak
> >
> >
> > mips64el-softmmu.mak
> > mips64-softmmu.mak
> > only differ the endianless
> If you look at git / mailing list history you'll see I spent more
> than a year unifying QEMU endianness. It was too much work for a
> single person so we decided to reduce the scope to ARM + MicroBlaze
> for single binary and we got MicroBlaze unified. We don't want
> an endianness-specific single binary. I'm not sure what you are
> trying to build, you didn't clearly explained what is your goal here.
>
> You can find series unifying endianness for MIPS, not merged because
> more things need to be addressed and not the priority.


Oh it's because target_arch is not setup properly for those arch


>From bcffa0d129fd864037b4e0f7b2f46f4889e76509 Mon Sep 17 00:00:00 2001
From: Yonggang Luo <[email protected]>
Date: Tue, 29 Sep 2026 02:47:48 +0800
Subject: [PATCH] target-info: preserve full softmmu target identity

Generate a full SysEmuTarget token separately from TARGET_ARCH, so variant
targets such as mipsel retain their QMP identity while user-mode targets
continue using the base architecture token.

Signed-off-by: Yonggang Luo <[email protected]>
---
 meson.build       | 5 +++++
 target-info-def.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/meson.build b/meson.build
index d63174ea8a4..e86daa47228 100644
--- a/meson.build
+++ b/meson.build
@@ -3319,6 +3319,9 @@ foreach target : target_dirs
   endif

   config_target += keyval.load('configs/targets' / target + '.mak')
+  if target.endswith('-softmmu')
+    config_target += { 'TARGET_SYS_EMU': config_target['TARGET_NAME'] }
+  endif

   target_kconfig = []
   foreach sym: accelerators
@@ -3374,6 +3377,8 @@ foreach target : target_dirs
       # do nothing
     elif k == 'TARGET_ARCH'
       config_target_data.set(k, v.to_upper())
+    elif k == 'TARGET_SYS_EMU'
+      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
       # not used to select files from sourcesets.
diff --git a/target-info-def.c b/target-info-def.c
index c02d98e6875..54e499712bf 100644
--- a/target-info-def.c
+++ b/target-info-def.c
@@ -28,7 +28,11 @@ QEMU_BUILD_BUG_ON(TARGET_PAGE_BITS < TARGET_PAGE_BITS_MIN);

 static const TargetInfo target_info_stub = {
     .target_name = TARGET_NAME,
+#ifdef CONFIG_SOFTMMU
+    .target_arch = glue(SYS_EMU_TARGET_, TARGET_SYS_EMU),
+#else
     .target_arch = glue(SYS_EMU_TARGET_, TARGET_ARCH),
+#endif
     .long_bits = TARGET_LONG_BITS,
     .cpu_type = CPU_RESOLVING_TYPE,
     .endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
-- 
2.52.0.windows.1





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

Reply via email to