On Mon, Sep 28, 2026 at 8:03 PM Markus Armbruster <[email protected]> wrote:
>
> Daniel P. Berrangé <[email protected]> writes:
>
> > 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.
> >
> > I don't think that we need to report machines though.
> > We already have 'query-machines' which gives much broader
> > information on the machines. "MachineInfo" needs to
> > gain
> >
> >    "targets": ["SysEmuTarget"]
> >
> > to list which target(s) a machine can be used with.
>
> Do we need query-targets at all?  What information does it provide that
> cannot easily be computed from query-machines once we add @target and
> @endiannes to MachineInfo?

It's a matrix by using different things as the primary key.
For query-machines, the machine name is the primary key.
For query-targets, the target name is the primary key. even though we can
compute
targets from query-machine, but that would be complicated. if query-targets
are really not wanted.
I'll drop it and rewrite tests with query-machine instead..


>
> >> +
> >> +##
> >> +# @query-targets:
> >> +#
> >> +# Return each target linked into this QEMU binary and the machines
> >> +# whose availability check accepts that target.
> >> +#
> >> +# Since: 11.2
> >> +#
> >> +# .. qmp-example::
> >> +#
> >> +#     -> { "execute": "query-targets" }
> >> +#     <- { "return": [ { "arch": "aarch64", "endianness": "little",
> >> +#                        "machines": [ "virt" ] } ] }
> >> +##
> >> +{ 'command': 'query-targets',
> >> +  'returns': ['TargetMachines'] }
> >
> >
> > With regards,
> > Daniel
>


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

Reply via email to