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.


> +
> +##
> +# @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
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Reply via email to