On Mon, Sep 28, 2026 at 10:38 PM Daniel P. Berrangé <[email protected]> wrote:
>
> On Mon, Sep 28, 2026 at 10:24:39PM +0800, Yonggang Luo wrote:
> > On Mon, Sep 28, 2026 at 6:14 PM Daniel P. Berrangé <[email protected]>
> > wrote:
> > >
> > > 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.
> > >
> >
> > This is my final design for the query-target / query-targets /
> > query-machines,
> > for consistency and testability.
> >
> > Per review: reuse `QemuTargetInfo` for both target commands, drop the
> > per-target machine list, and let
> > `MachineInfo` say which target(s) each machine runs on.
> > `QemuTargetInfo` stays small; `query-target` and `query-targets` return a
> > derived struct that adds the target's device and accel Kconfig state.
> >
> > ## QemuTargetInfo
> >
> > ```
> > { 'struct': 'QemuTargetInfo',
> > 'data': { 'arch': 'SysEmuTarget' } } # since 1.2
> > ```
>
> > ## QemuTargetDetails: QemuTargetInfo plus kconfig
> >
> > ```
> > { 'struct': 'QemuTargetDetails',
> > 'base': 'QemuTargetInfo',
> > 'data': { 'kconfig': 'any' } }
> > ```
> >
> > `kconfig` maps every device and accel `CONFIG_*` symbol to whether it
> > is enabled for that target.
>
> KConfig is an internal implementation detail that should not be exposed
> to management apps as we don't want KConfig to become an ABI we must
> preserve. QAPI introspection provides feature based information to
> the user. eg instead of querying for "CONFIG_SEV", qom-list-types can
> be queried to look for the 'sev-guest' class.
For example, `TYPE_NITRO_ENCLAVE_MACHINE` is available only when
`CONFIG_NITRO_ENCLAVE` is enabled for the target. When I construct the
machine list literal,
I need this information to help me to check if the machine is listed
in qemu-system that matches
qemu-sysetem-$arch. That needs a QAPI for it. What's the method you
would suggest
for? Otherwise, the test for the listing machine names can not be
reliably running for it.
for example:
/*
* Machines omitted from the normal lists. Merged in when @kconfig is
* true in the target's query-targets "kconfig" object, which already
* folds in host libraries and accelerators. xenfv is an alias of
* xenfv-4.2.
*/
static const char * const xen_pc_machines[] = {
"xenpv",
"xenpvh",
"xenfv-4.2",
};
static const char * const xen_aarch64_machines[] = {
"xenpvh",
};
static const char * const vmapple_machines[] = {
"vmapple",
};
static const char * const microvm_machines[] = {
"microvm",
};
static const char * const nitro_machines[] = {
"nitro",
};
static const char * const nitro_enclave_machines[] = {
"nitro-enclave",
};
static const char * const x_remote_machines[] = {
"x-remote",
};
#define SPECIAL(t, k, m) { t, k, m, G_N_ELEMENTS(m) }
static const struct SpecialMachineMap {
const char *target;
const char *kconfig;
const char * const *machines;
size_t n_machines;
} special_machine_map[] = {
SPECIAL("i386", "CONFIG_XEN", xen_pc_machines),
SPECIAL("x86_64", "CONFIG_XEN", xen_pc_machines),
SPECIAL("aarch64", "CONFIG_XEN", xen_aarch64_machines),
SPECIAL("aarch64", "CONFIG_VMAPPLE", vmapple_machines),
SPECIAL("i386", "CONFIG_MICROVM", microvm_machines),
SPECIAL("x86_64", "CONFIG_MICROVM", microvm_machines),
SPECIAL("x86_64", "CONFIG_NITRO_MACHINE", nitro_machines),
SPECIAL("aarch64", "CONFIG_NITRO_MACHINE", nitro_machines),
SPECIAL("i386", "CONFIG_NITRO_ENCLAVE", nitro_enclave_machines),
SPECIAL("x86_64", "CONFIG_NITRO_ENCLAVE", nitro_enclave_machines),
SPECIAL("i386", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("x86_64", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("aarch64", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("ppc", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("ppc64", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("s390x", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("riscv64", "CONFIG_MULTIPROCESS", x_remote_machines),
SPECIAL("loongarch64", "CONFIG_MULTIPROCESS", x_remote_machines),
};
#undef SPECIAL
These machines all depend on the kconfig. When I try to write qtest
for it, I need the CONFIG_* information to be returned for them.
>
>
> 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 :|
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo