hw/core: Filter machine list available for a particular target binary
Binaries can register a QOM type to filter their machines
by filling their TargetInfo::machine_typename field.
Commit 28502121be ("system/vl: Filter machine list available
for a particular target binary") added the filter to
machine_help_func() but missed the other places where the machine
list must be filtered, such QMP 'query-machines' command used by
QTests, and select_machine(). Fix that.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20251020220941.65269-2-philmd@linaro.org>
This commit is contained in:
parent
dcff29f4cc
commit
2c6fab1c14
3 changed files with 7 additions and 3 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "qapi/qobject-input-visitor.h"
|
||||
#include "qapi/type-helpers.h"
|
||||
#include "qemu/uuid.h"
|
||||
#include "qemu/target-info.h"
|
||||
#include "qemu/target-info-qapi.h"
|
||||
#include "qom/qom-qobject.h"
|
||||
#include "system/hostmem.h"
|
||||
|
|
@ -94,9 +95,10 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
|
|||
MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
|
||||
Error **errp)
|
||||
{
|
||||
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
|
||||
GSList *el, *machines;
|
||||
MachineInfoList *mach_list = NULL;
|
||||
|
||||
machines = object_class_get_list(target_machine_typename(), false);
|
||||
for (el = machines; el; el = el->next) {
|
||||
MachineClass *mc = el->data;
|
||||
const char *default_cpu_type = machine_class_default_cpu_type(mc);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/target-info.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-commands-misc.h"
|
||||
#include "qobject/qlist.h"
|
||||
|
|
@ -128,7 +129,7 @@ static CommandLineParameterInfoList *query_all_machine_properties(void)
|
|||
ObjectProperty *prop;
|
||||
bool is_new;
|
||||
|
||||
machines = object_class_get_list(TYPE_MACHINE, false);
|
||||
machines = object_class_get_list(target_machine_typename(), false);
|
||||
assert(machines);
|
||||
|
||||
/* Loop over all machine classes */
|
||||
|
|
|
|||
|
|
@ -1672,7 +1672,8 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
|
|||
{
|
||||
ERRP_GUARD();
|
||||
const char *machine_type = qdict_get_try_str(qdict, "type");
|
||||
g_autoptr(GSList) machines = object_class_get_list(TYPE_MACHINE, false);
|
||||
g_autoptr(GSList) machines = object_class_get_list(target_machine_typename(),
|
||||
false);
|
||||
MachineClass *machine_class = NULL;
|
||||
|
||||
if (machine_type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue