* [PATCH v2 0/9] machine: uniquify virt QOM names
@ 2026-09-22 21:55 Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
` (8 more replies)
0 siblings, 9 replies; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Multiple targets register a virt board as MACHINE_TYPE_NAME("virt").
Those QOM types collide if more than one board is linked into one
qemu-system process. This series splits the QOM type from the -M name
so each virt board can keep a unique type while -M virt, help, and
migration stay the same.
- Add machine_class_set_name() so boards can set MachineClass::name
when it must differ from the QOM type. machine_class_base_init still
defaults the name to the QOM type without -machine. Document that
MachineClass::name is the -M name, not the QOM type. Sort -M help
by that name so order matches the printed names after types are
prefixed (arm-virt-11.1-machine vs virt-11.1).
- Give each colliding virt board a unique QOM type and keep the
existing -M name via machine_class_set_name(): riscv-virt, arm-virt,
or1k-virt, hexagon-virt, loongarch-virt, m68k-virt, and xtensa-virt.
Versioned ARM, LoongArch, and M68K boards keep virt-<ver>. Latest
ARM virt still sets mc->alias to virt.
- query-machines returns MachineInfo typename, the QOM type from
object_class_get_name(), for qom-list-properties. The -M name alone
is not that type once virt boards are prefixed.
Changes v1 -> v2:
- query-machines returns MachineInfo typename. v1 returned only the
-M name, so a client that appended "-machine" looked up the wrong
type for a prefixed board such as arm-virt-11.1-machine versus
-M virt-11.1.
Yonggang Luo (9):
machine: allow -M name to differ from QOM type
hw/riscv/virt: use unique QOM name
hw/arm/virt: use unique QOM name
hw/or1k/virt: use unique QOM name
hw/hexagon/virt: use unique QOM name
hw/loongarch/virt: use unique QOM name
hw/m68k/virt: use unique QOM name
hw/xtensa/virt: use unique QOM name
qapi: return MachineInfo typename from query-machines
hw/arm/virt.c | 3 +-
hw/core/machine-qmp-cmds.c | 1 +
hw/core/machine.c | 6 ++++
hw/hexagon/virt.c | 1 +
hw/loongarch/virt.c | 3 +-
hw/m68k/virt.c | 7 ++--
hw/or1k/virt.c | 3 +-
hw/riscv/virt.c | 3 +-
hw/xtensa/virt.c | 3 +-
include/hw/arm/virt.h | 2 +-
include/hw/core/boards.h | 12 ++++++-
include/hw/hexagon/virt.h | 2 +-
include/hw/loongarch/virt.h | 2 +-
include/hw/riscv/virt.h | 2 +-
qapi/machine.json | 6 +++-
system/vl.c | 8 ++---
tests/qtest/qom-test.c | 65 +++++++++++++++++++++++++++++++++----
17 files changed, 104 insertions(+), 25 deletions(-)
--
2.52.0.windows.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/9] machine: allow -M name to differ from QOM type
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 5:01 ` Pierrick Bouvier
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 2/9] hw/riscv/virt: use unique QOM name Yonggang Luo
` (7 subsequent siblings)
8 siblings, 2 replies; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
- Add machine_class_set_name() so boards can keep a stable -M name
when the QOM type is uniquified. machine_class_base_init still
defaults the name to the QOM type without -machine.
- Document that MachineClass::name is the -M name, not the QOM type.
- Sort -M help by MachineClass::name so order matches the printed names
when QOM types are prefixed (arm-virt-11.1-machine vs virt-11.1).
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
hw/core/machine.c | 6 ++++++
include/hw/core/boards.h | 12 +++++++++++-
system/vl.c | 8 +++-----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 92f7be52a13..6b933f2302d 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1215,6 +1215,12 @@ static void machine_class_init(ObjectClass *oc, const void *data)
"Memory size configuration");
}
+void machine_class_set_name(MachineClass *mc, const char *name)
+{
+ g_free(mc->name);
+ mc->name = g_strdup(name);
+}
+
static void machine_class_base_init(ObjectClass *oc, const void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
index 3b86724cf00..851140ad052 100644
--- a/include/hw/core/boards.h
+++ b/include/hw/core/boards.h
@@ -36,6 +36,16 @@ const char *machine_default_cpu_type(const MachineState *ms);
* @mc: Machine class
*/
const char *machine_class_default_cpu_type(MachineClass *mc);
+/**
+ * machine_class_set_name: Set the -M name when it differs from the QOM type
+ * @mc: Machine class
+ * @name: Name used by -M lookup, help, and migration
+ *
+ * machine_class_base_init sets MachineClass::name from the QOM type with
+ * the -machine suffix removed. Call this from board class_init when the
+ * CLI name must stay stable after the QOM type is uniquified.
+ */
+void machine_class_set_name(MachineClass *mc, const char *name);
void machine_add_audiodev_property(MachineClass *mc);
void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp);
@@ -269,7 +279,7 @@ struct MachineClass {
/*< public >*/
const char *family; /* NULL iff @name identifies a standalone machtype */
- char *name;
+ char *name; /* -M name; default is QOM type without -machine */
const char *alias;
const char *desc;
const char *deprecation_reason;
diff --git a/system/vl.c b/system/vl.c
index 468a9fc247a..0d52c5d0a46 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1538,10 +1538,9 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b, gpointer d)
if (mc1->family == NULL) {
if (mc2->family == NULL) {
/* Compare standalone machine types against each other; they sort
- * in increasing order.
+ * in increasing order by the name shown in -M help.
*/
- return strcmp(object_class_get_name(OBJECT_CLASS(mc1)),
- object_class_get_name(OBJECT_CLASS(mc2)));
+ return strcmp(mc1->name, mc2->name);
}
/* Standalone machine types sort after families. */
@@ -1560,8 +1559,7 @@ static gint machine_class_cmp(gconstpointer a, gconstpointer b, gpointer d)
}
/* Within the same family, machine types sort in decreasing order. */
- return strcmp(object_class_get_name(OBJECT_CLASS(mc2)),
- object_class_get_name(OBJECT_CLASS(mc1)));
+ return strcmp(mc2->name, mc1->name);
}
static void machine_help_func(const QDict *qdict)
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 2/9] hw/riscv/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 3/9] hw/arm/virt: " Yonggang Luo
` (6 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Use TYPE_RISCV_VIRT_MACHINE so the RISC-V virt QOM type does not
collide with ARM virt in a combined qemu-system binary. Keep the
-M / help / migration name as virt via machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/riscv/virt.c | 3 ++-
include/hw/riscv/virt.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index d4b501802f6..b29182cb39b 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -1134,6 +1134,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
mc->desc = "RISC-V VirtIO board";
+ machine_class_set_name(mc, "virt");
mc->init = virt_machine_init;
mc->max_cpus = VIRT_CPUS_MAX;
mc->default_cpu_type = TYPE_RISCV_CPU_BASE;
@@ -1197,7 +1198,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
}
static const TypeInfo virt_machine_typeinfo = {
- .name = MACHINE_TYPE_NAME("virt"),
+ .name = TYPE_RISCV_VIRT_MACHINE,
.parent = TYPE_MACHINE,
.class_init = virt_machine_class_init,
.instance_init = virt_machine_instance_init,
diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
index e516898f9ad..969aa5866ee 100644
--- a/include/hw/riscv/virt.h
+++ b/include/hw/riscv/virt.h
@@ -30,7 +30,7 @@
#define VIRT_SOCKETS_MAX_BITS 2
#define VIRT_SOCKETS_MAX (1 << VIRT_SOCKETS_MAX_BITS)
-#define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("riscv-virt")
typedef struct RISCVVirtState RISCVVirtState;
DECLARE_INSTANCE_CHECKER(RISCVVirtState, RISCV_VIRT_MACHINE,
TYPE_RISCV_VIRT_MACHINE)
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 3/9] hw/arm/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 2/9] hw/riscv/virt: use unique QOM name Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 4/9] hw/or1k/virt: " Yonggang Luo
` (5 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Set TYPE_VIRT_MACHINE to MACHINE_TYPE_NAME("arm-virt") so ARM virt
no longer collides with other virt-machine types in one process.
Keep the -M / help / migration name as virt-* via
machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/arm/virt.c | 3 ++-
include/hw/arm/virt.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 3eecf094bcc..c8ffa1ceaf4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -123,13 +123,14 @@ static void arm_virt_compat_default_set(MachineClass *mc)
MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " ARM Virtual Machine"; \
MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+ machine_class_set_name(mc, "virt-" MACHINE_VER_STR(__VA_ARGS__)); \
if (latest) { \
mc->alias = "virt"; \
} \
} \
static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
{ \
- .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \
+ .name = MACHINE_VER_TYPE_NAME("arm-virt", __VA_ARGS__), \
.parent = TYPE_VIRT_MACHINE, \
.class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
}; \
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 22e66d1a113..383ee320948 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -215,7 +215,7 @@ struct VirtMachineState {
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
-#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("arm-virt")
OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE)
void virt_acpi_setup(VirtMachineState *vms);
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 4/9] hw/or1k/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (2 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 3/9] hw/arm/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 5/9] hw/hexagon/virt: " Yonggang Luo
` (4 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Set TYPE_VIRT_MACHINE to MACHINE_TYPE_NAME("or1k-virt") so OpenRISC
virt no longer collides with other virt-machine types in one process.
Keep the -M / help / migration name as virt via
machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/or1k/virt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/or1k/virt.c b/hw/or1k/virt.c
index 2ff5c084a2b..35884252379 100644
--- a/hw/or1k/virt.c
+++ b/hw/or1k/virt.c
@@ -34,7 +34,7 @@
#define VIRT_CPUS_MAX 4
#define VIRT_CLK_MHZ 20000000
-#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("or1k-virt")
#define VIRT_MACHINE(obj) \
OBJECT_CHECK(OR1KVirtState, (obj), TYPE_VIRT_MACHINE)
@@ -548,6 +548,7 @@ static void openrisc_virt_machine_init(ObjectClass *oc, const void *data)
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "or1k virtual machine";
+ machine_class_set_name(mc, "virt");
mc->init = openrisc_virt_init;
mc->max_cpus = VIRT_CPUS_MAX;
mc->is_default = false;
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 5/9] hw/hexagon/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (3 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 4/9] hw/or1k/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 6/9] hw/loongarch/virt: " Yonggang Luo
` (3 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Set TYPE_HEXAGON_VIRT_MACHINE to MACHINE_TYPE_NAME("hexagon-virt") so
Hexagon virt no longer collides with other virt-machine types in one
process. Keep the -M / help / migration name as virt via
machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
hw/hexagon/virt.c | 1 +
include/hw/hexagon/virt.h | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c
index 64d8366d27d..04591066bef 100644
--- a/hw/hexagon/virt.c
+++ b/hw/hexagon/virt.c
@@ -359,6 +359,7 @@ static void virt_class_init(ObjectClass *oc, const void *data)
MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Hexagon Virtual Machine";
+ machine_class_set_name(mc, "virt");
mc->init = virt_init;
mc->default_cpu_type = HEXAGON_CPU_TYPE_NAME("v68");
mc->default_ram_size = 4 * GiB;
diff --git a/include/hw/hexagon/virt.h b/include/hw/hexagon/virt.h
index 4ca2f1ef859..523c4858036 100644
--- a/include/hw/hexagon/virt.h
+++ b/include/hw/hexagon/virt.h
@@ -26,7 +26,7 @@ struct HexagonVirtMachineState {
void hexagon_load_fdt(const struct HexagonVirtMachineState *vms);
-#define TYPE_HEXAGON_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define TYPE_HEXAGON_VIRT_MACHINE MACHINE_TYPE_NAME("hexagon-virt")
OBJECT_DECLARE_SIMPLE_TYPE(HexagonVirtMachineState, HEXAGON_VIRT_MACHINE)
#endif /* HW_HEXAGONVIRT_H */
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 6/9] hw/loongarch/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (4 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 5/9] hw/hexagon/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 7/9] hw/m68k/virt: " Yonggang Luo
` (2 subsequent siblings)
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Set TYPE_LOONGARCH_VIRT_MACHINE to MACHINE_TYPE_NAME("loongarch-virt")
so LoongArch virt no longer collides with other virt-machine types in
one process. Keep the -M / help / migration name as virt-* via
machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/loongarch/virt.c | 3 ++-
include/hw/loongarch/virt.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 9c5371af9de..2b003443eb0 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -1543,6 +1543,7 @@ static void virt_class_init(ObjectClass *oc, const void *data)
MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " LoongArch Virtual Machine"; \
MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+ machine_class_set_name(mc, "virt-" MACHINE_VER_STR(__VA_ARGS__)); \
if (latest) { \
mc->alias = "virt"; \
mc->is_default = true; \
@@ -1550,7 +1551,7 @@ static void virt_class_init(ObjectClass *oc, const void *data)
} \
static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
{ \
- .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \
+ .name = MACHINE_VER_TYPE_NAME("loongarch-virt", __VA_ARGS__), \
.parent = TYPE_LOONGARCH_VIRT_MACHINE, \
.class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
}; \
diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h
index d39a9bbf5dd..09529de48bd 100644
--- a/include/hw/loongarch/virt.h
+++ b/include/hw/loongarch/virt.h
@@ -130,7 +130,7 @@ struct LoongArchVirtMachineState {
bool highmem_mmio;
};
-#define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
+#define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("loongarch-virt")
OBJECT_DECLARE_SIMPLE_TYPE(LoongArchVirtMachineState, LOONGARCH_VIRT_MACHINE)
void virt_acpi_setup(LoongArchVirtMachineState *lvms);
void virt_fdt_setup(LoongArchVirtMachineState *lvms);
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 7/9] hw/m68k/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (5 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 6/9] hw/loongarch/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 8/9] hw/xtensa/virt: " Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines Yonggang Luo
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Set the parent and versioned QOM types to m68k-virt so M68K virt no
longer collides with other virt-machine types in one process. Keep
the -M / help / migration name as virt-* via
machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/m68k/virt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 274970978ff..1faa178bdfc 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -323,7 +323,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
}
static const TypeInfo virt_machine_info = {
- .name = MACHINE_TYPE_NAME("virt"),
+ .name = MACHINE_TYPE_NAME("m68k-virt"),
.parent = TYPE_MACHINE,
.abstract = true,
.class_init = virt_machine_class_init,
@@ -345,14 +345,15 @@ type_init(virt_machine_register_types)
MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " M68K Virtual Machine"; \
MACHINE_VER_DEPRECATION(__VA_ARGS__); \
+ machine_class_set_name(mc, "virt-" MACHINE_VER_STR(__VA_ARGS__)); \
if (latest) { \
mc->alias = "virt"; \
} \
} \
static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = \
{ \
- .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \
- .parent = MACHINE_TYPE_NAME("virt"), \
+ .name = MACHINE_VER_TYPE_NAME("m68k-virt", __VA_ARGS__), \
+ .parent = MACHINE_TYPE_NAME("m68k-virt"), \
.class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
}; \
static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 8/9] hw/xtensa/virt: use unique QOM name
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (6 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 7/9] hw/m68k/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines Yonggang Luo
8 siblings, 1 reply; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Register the board as xtensa-virt so Xtensa virt no longer collides
with other virt-machine types in one process. Keep the -M / help /
migration name as virt via machine_class_set_name().
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/xtensa/virt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/xtensa/virt.c b/hw/xtensa/virt.c
index 271f06e0953..dc5b255b9b1 100644
--- a/hw/xtensa/virt.c
+++ b/hw/xtensa/virt.c
@@ -118,10 +118,11 @@ static void xtensa_virt_init(MachineState *machine)
static void xtensa_virt_machine_init(MachineClass *mc)
{
mc->desc = "virt machine (" XTENSA_DEFAULT_CPU_MODEL ")";
+ machine_class_set_name(mc, "virt");
mc->init = xtensa_virt_init;
mc->max_cpus = 32;
mc->default_cpu_type = XTENSA_DEFAULT_CPU_TYPE;
mc->default_nic = "virtio-net-pci";
}
-DEFINE_MACHINE("virt", xtensa_virt_machine_init)
+DEFINE_MACHINE("xtensa-virt", xtensa_virt_machine_init)
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
` (7 preceding siblings ...)
2026-09-22 21:55 ` [PATCH v2 8/9] hw/xtensa/virt: " Yonggang Luo
@ 2026-09-22 21:55 ` Yonggang Luo
2026-09-23 8:33 ` Daniel P. Berrangé
2026-09-23 10:56 ` marcandre.lureau
8 siblings, 2 replies; 22+ messages in thread
From: Yonggang Luo @ 2026-09-22 21:55 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
query-machines returned only the -M name, so management apps inferred
the QOM type as that name plus "-machine". A prefixed type such as
arm-virt-11.1-machine no longer matches -M virt-11.1. Return the QOM
type in MachineInfo typename from object_class_get_name() in
qmp_query_machines(). test_query_machines_typename checks that
qom-list-properties accepts it.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
hw/core/machine-qmp-cmds.c | 1 +
qapi/machine.json | 6 +++-
tests/qtest/qom-test.c | 65 ++++++++++++++++++++++++++++++++++----
3 files changed, 65 insertions(+), 7 deletions(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 9c08b17510a..27ceed54a14 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -116,6 +116,7 @@ MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
}
info->name = g_strdup(mc->name);
+ info->q_typename = g_strdup(object_class_get_name(OBJECT_CLASS(mc)));
info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
info->numa_mem_supported = mc->numa_mem_supported;
diff --git a/qapi/machine.json b/qapi/machine.json
index b1be5608b61..f5ead98e174 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -168,6 +168,9 @@
#
# @name: the name of the machine
#
+# @typename: QOM type name of the machine, for qom-list-properties
+# (since 11.2)
+#
# @alias: an alias for the machine name
#
# @is-default: whether the machine is default
@@ -208,7 +211,7 @@
# Since: 1.2
##
{ 'struct': 'MachineInfo',
- 'data': { 'name': 'str', '*alias': 'str',
+ 'data': { 'name': 'str', 'typename': 'str', '*alias': 'str',
'*is-default': 'bool', 'cpu-max': 'int',
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
'deprecated': 'bool', '*default-cpu-type': 'str',
@@ -238,6 +241,7 @@
# {
# "hotpluggable-cpus": true,
# "name": "pc-q35-6.2",
+# "typename": "pc-q35-6.2-machine",
# "compat-props": [
# {
# "qom-type": "virtio-mem",
diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c
index cf4c6b5add5..4ee95af6d94 100644
--- a/tests/qtest/qom-test.c
+++ b/tests/qtest/qom-test.c
@@ -200,13 +200,32 @@ static void test_machine(gconstpointer data)
if (g_test_slow()) {
/* Make sure we can get the machine class properties: */
- g_autofree char *qom_machine = g_strdup_printf("%s-machine", machine);
-
- response = qtest_qmp(qts, "{ 'execute': 'qom-list-properties',"
- " 'arguments': { 'typename': %s } }",
- qom_machine);
- g_assert(response);
+ QList *list;
+ const QListEntry *p;
+ bool found = false;
+
+ response = qtest_qmp(qts, "{ 'execute': 'query-machines' }");
+ g_assert(!qdict_haskey(response, "error"));
+ list = qdict_get_qlist(response, "return");
+ g_assert(list);
+ for (p = qlist_first(list); p; p = qlist_next(p)) {
+ QDict *minfo = qobject_to(QDict, qlist_entry_obj(p));
+ QDict *props;
+
+ if (strcmp(qdict_get_str(minfo, "name"), machine)) {
+ continue;
+ }
+ props = qtest_qmp(qts, "{ 'execute': 'qom-list-properties',"
+ " 'arguments': { 'typename': %s } }",
+ qdict_get_str(minfo, "typename"));
+ g_assert(!qdict_haskey(props, "error"));
+ g_assert(qdict_haskey(props, "return"));
+ qobject_unref(props);
+ found = true;
+ break;
+ }
qobject_unref(response);
+ g_assert(found);
}
test_properties(qts, "/machine", true);
@@ -218,6 +237,39 @@ static void test_machine(gconstpointer data)
qtest_quit(qts);
}
+static void test_query_machines_typename(void)
+{
+ QTestState *qts;
+ QDict *response;
+ QList *list;
+ const QListEntry *p;
+ bool saw = false;
+
+ qts = qtest_init("-machine none");
+ response = qtest_qmp(qts, "{ 'execute': 'query-machines' }");
+ g_assert(!qdict_haskey(response, "error"));
+ list = qdict_get_qlist(response, "return");
+ g_assert(list);
+
+ for (p = qlist_first(list); p; p = qlist_next(p)) {
+ QDict *minfo = qobject_to(QDict, qlist_entry_obj(p));
+ const char *typename = qdict_get_str(minfo, "typename");
+ g_autoptr(QDict) props = NULL;
+
+ g_assert(g_str_has_suffix(typename, "-machine"));
+ props = qtest_qmp(qts, "{ 'execute': 'qom-list-properties',"
+ " 'arguments': { 'typename': %s } }",
+ typename);
+ g_assert(!qdict_haskey(props, "error"));
+ g_assert(qdict_haskey(props, "return"));
+ saw = true;
+ }
+
+ g_assert(saw);
+ qobject_unref(response);
+ qtest_quit(qts);
+}
+
static void add_machine_test_case(const char *mname)
{
char *path;
@@ -250,6 +302,7 @@ int main(int argc, char **argv)
qtest_cb_for_every_machine(add_machine_test_case, g_test_quick());
qtest_add_func("qom/qom-qtests", test_qom_qtests);
+ qtest_add_func("qom/machine-typename", test_query_machines_typename);
return g_test_run();
}
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 1/9] machine: allow -M name to differ from QOM type
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
@ 2026-09-23 5:01 ` Pierrick Bouvier
2026-09-23 5:56 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
1 sibling, 1 reply; 22+ messages in thread
From: Pierrick Bouvier @ 2026-09-23 5:01 UTC (permalink / raw)
To: Yonggang Luo, qemu-devel
Cc: Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
Hi Yonggang,
On 9/22/26 2:55 PM, Yonggang Luo wrote:
> - Add machine_class_set_name() so boards can keep a stable -M name
> when the QOM type is uniquified. machine_class_base_init still
> defaults the name to the QOM type without -machine.
> - Document that MachineClass::name is the -M name, not the QOM type.
> - Sort -M help by MachineClass::name so order matches the printed names
> when QOM types are prefixed (arm-virt-11.1-machine vs virt-11.1).
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> hw/core/machine.c | 6 ++++++
> include/hw/core/boards.h | 12 +++++++++++-
> system/vl.c | 8 +++-----
> 3 files changed, 20 insertions(+), 6 deletions(-)
>
this indeed allows QOM types to coexist in same binary.
In such binary, how are we now supposed to differentiate two virt
machines from -M <name>, given they both have same alias name?
Regards,
Pierrick
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 1/9] machine: allow -M name to differ from QOM type
2026-09-23 5:01 ` Pierrick Bouvier
@ 2026-09-23 5:56 ` Yonggang Luo
0 siblings, 0 replies; 22+ messages in thread
From: Yonggang Luo @ 2026-09-23 5:56 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
[-- Attachment #1: Type: text/plain, Size: 6530 bytes --]
On Wed, Sep 23, 2026 at 1:01 PM Pierrick Bouvier <
pierrick.bouvier@oss.qualcomm.com> wrote:
>
> this indeed allows QOM types to coexist in same binary.
> In such binary, how are we now supposed to differentiate two virt
> machines from -M <name>, given they both have same alias name?
>
> Regards,
> Pierrick
# Machine option demos
Intended design for combined `qemu-system`. Implement to match these
rows. Last `-M` / `-machine` / `-readconfig` wins. `qemu.conf` is
applied first.
`arch:name` binds `arch` and picks `name`. `arch:` binds `arch`.
`x86_64:` and `i386:` then run that target's default machine.
`aarch64:` and `riscv64:` have no default and exit with
`No machine specified, and there is no default`. A later bare
`name` keeps the last prefix. Help / `?` after `arch:` lists that
target; it does not leave the target at `none`.
Single-target rows are historic `qemu-system-<arch>` and stay as they
are.
## Bind and run
| Command | Shows |
|---------|-------|
| `qemu-system -M aarch64:virt` | Bind `aarch64`, run `virt`. |
| `qemu-system -M x86_64:q35` | Bind `x86_64`, run `q35`. |
| `qemu-system -M riscv64:virt` | Bind `riscv64`, run `virt`. |
| `qemu-system -M type=aarch64:virt` | Same as `-M aarch64:virt`. |
| `qemu-system -machine aarch64:virt` | Same as `-M`. |
| `qemu-system-aarch64 -M virt` | Historic. No `arch:` bind. |
| `qemu-system-x86_64` | Single-target default (`pc` / `q35`). |
## Default machine (`arch:`)
| Command | Shows |
|---------|-------|
| `qemu-system -M x86_64:` | Bind `x86_64`, run that target's default. |
| `qemu-system -M i386:` | Bind `i386`, run that target's default. |
| `qemu-system -M aarch64:` | Bind `aarch64`, then `No machine specified,
and there is no default`. |
| `qemu-system -M riscv64:` | Bind `riscv64`, then the same error. |
| `qemu-system -M none:` | Target `none`, empty `none` machine. |
## List
| Command | Shows |
|---------|-------|
| `qemu-system -M help` | Grouped list. `none:` first, then each target. |
| `qemu-system -M ?` | Same as `-M help`. |
| `qemu-system -M aarch64:help` | Flat list for `aarch64` only. |
| `qemu-system -M aarch64:?` | Same as `-M aarch64:help`. |
| `qemu-system -M riscv64:help` | Flat list for `riscv64` only. |
| `qemu-system -M none:help` | `none` and `empty machine`. No other target
group. |
| `qemu-system-aarch64 -M help` | Flat list for that target only. |
## Empty machine
| Command | Shows |
|---------|-------|
| `qemu-system` | Target `none`, empty `none` machine. |
| `qemu-system -M none` | Empty `none` machine. |
| `qemu-system -M none:none` | Same. |
| `qemu-system -M aarch64:none` | Target `aarch64`, empty `none` machine. |
| `qemu-system -M aarch64:virt -M none` | Empty `none` machine. Target
stays `aarch64`. |
## Properties
| Command | Shows |
|---------|-------|
| `qemu-system -M aarch64:virt,help` | Bind `aarch64`, dump `virt`
properties. |
| `qemu-system -M aarch64:,help` | `No machine specified, and there is no
default`. |
| `qemu-system -M virt,help` | `machine type "virt" needs an arch: prefix`.
|
| `qemu-system -M none,help` | Dump empty `none` machine properties. |
| `qemu-system-aarch64 -M virt,help` | Historic property dump for `virt`. |
## Last `-M` wins
| Command | Shows |
|---------|-------|
| `qemu-system -M aarch64:virt -M x86_64:q35` | Target `x86_64`, machine
`q35`. |
| `qemu-system -M aarch64:virt -M virt` | Last name is `virt`. Keep prefix
`aarch64`, run `virt`. |
| `qemu-system -M virt -M aarch64:virt` | Target `aarch64`, machine `virt`.
|
| `qemu-system -M aarch64: -M virt` | Bind `aarch64`, then bare `virt` runs
`virt`. |
| `qemu-system -M aarch64:virt -M riscv64:` | Bind `riscv64`, then `No
machine specified, and there is no default`. |
| `qemu-system -M aarch64:virt -M riscv64:virt` | Target `riscv64`, machine
`virt`. |
| `qemu-system -M help -M aarch64:virt` | Help is not last; run
`aarch64:virt`. |
| `qemu-system -M aarch64:virt -M help` | Keep prefix `aarch64`. List has
`virt`, not `q35`. |
## `-readconfig`
A `[machine] type = "..."` file is another machine option. The last
of `-M`, `-machine`, and `-readconfig` wins.
| Command | Shows |
|---------|-------|
| `-readconfig` with `type = "aarch64:virt"` | Bind `aarch64`, run `virt`. |
| that file, then `-M none` | Machine `none`. Target stays `aarch64`. |
| `-readconfig` with `type = "none:"` | Target `none`, empty `none`
machine. |
| `-M aarch64:virt`, then `-readconfig` `type = "riscv64:virt"` | Target
`riscv64`, machine `virt`. |
## Wrong target or machine
| Command | Shows |
|---------|-------|
| `qemu-system -M virt` | `machine type "virt" needs an arch: prefix` |
| `qemu-system -M riscv64` | Same. Bare `riscv64` is a machine name, not a
target. |
| `qemu-system -M aarch64` | Same. Bare `aarch64` is a machine name, not a
target. |
| `qemu-system -M aarch64:q35` | Target `aarch64`, then `unsupported
machine type: "aarch64:q35"` |
| `qemu-system -M arm:sbsa-ref` | Target `arm`, then unsupported
(`sbsa-ref` is `aarch64` only). |
| `qemu-system -M aarch64:no-such` | Target `aarch64`, then `unsupported
machine type: "aarch64:no-such"` |
| `qemu-system -M no-such:virt` | `target 'no-such' is not available` |
| `qemu-system -M AARCH64:virt` | `target 'AARCH64' is not available`
(names are lowercase). |
| `qemu-system -M none:virt` | `machine type "none:virt" is not available
for target none` |
## Odd strings
| Command | Shows |
|---------|-------|
| `qemu-system -M :virt` | Not a prefix. Same as bare `virt`: needs
`arch:`. |
| `qemu-system -M :` | Not a prefix. Unsupported machine `:` / needs
`arch:`. |
| `qemu-system -M aarch64:virt:extra` | First colon only. Name is
`virt:extra`. Unsupported machine. |
| `qemu-system-x86_64 -M aarch64:virt` | Prefix `aarch64` != `x86_64`. Not
available for this target. |
| `qemu-system-aarch64 -M aarch64:virt` | Prefix matches. Run `virt`. |
## Intended grouped `-M help` (no target)
| Group | Contents |
|-------|----------|
| `none:` | only `none` |
| `i386:` and `x86_64:` | pc / q35 / isapc / microvm / xen / nitro |
| `arm:` and `aarch64:` | `virt-*` and 32-bit ARM boards |
| `aarch64:` only | sbsa-ref, versal, zcu102, imx8, npcm845, raspi3/4,
ast2700 |
| `riscv32:` and `riscv64:` | RISC-V boards |
| `microblaze:` | petalogix and xlnx-zynqmp-pmu |
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 7042 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines
2026-09-22 21:55 ` [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines Yonggang Luo
@ 2026-09-23 8:33 ` Daniel P. Berrangé
2026-09-23 10:56 ` marcandre.lureau
1 sibling, 0 replies; 22+ messages in thread
From: Daniel P. Berrangé @ 2026-09-23 8:33 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Paolo Bonzini, Eric Blake
On Wed, Sep 23, 2026 at 05:55:32AM +0800, Yonggang Luo wrote:
> query-machines returned only the -M name, so management apps inferred
> the QOM type as that name plus "-machine". A prefixed type such as
> arm-virt-11.1-machine no longer matches -M virt-11.1. Return the QOM
> type in MachineInfo typename from object_class_get_name() in
> qmp_query_machines(). test_query_machines_typename checks that
> qom-list-properties accepts it.
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> hw/core/machine-qmp-cmds.c | 1 +
> qapi/machine.json | 6 +++-
> tests/qtest/qom-test.c | 65 ++++++++++++++++++++++++++++++++++----
> 3 files changed, 65 insertions(+), 7 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 1/9] machine: allow -M name to differ from QOM type
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-23 5:01 ` Pierrick Bouvier
@ 2026-09-23 10:56 ` marcandre.lureau
1 sibling, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
> - Add machine_class_set_name() so boards can keep a stable -M name
> when the QOM type is uniquified. machine_class_base_init still
> defaults the name to the QOM type without -machine.
> - Document that MachineClass::name is the -M name, not the QOM type.
> - Sort -M help by MachineClass::name so order matches the printed names
> when QOM types are prefixed (arm-virt-11.1-machine vs virt-11.1).
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Message-ID: <20260922215533.641-2-luoyonggang@gmail.com>
>
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 92f7be52a13f..6b933f2302d5 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -1215,6 +1215,12 @@ static void machine_class_init(ObjectClass *oc, const void *data)
> "Memory size configuration");
> }
>
> +void machine_class_set_name(MachineClass *mc, const char *name)
> +{
> + g_free(mc->name);
> + mc->name = g_strdup(name);
> +}
> +
> static void machine_class_base_init(ObjectClass *oc, const void *data)
> {
> MachineClass *mc = MACHINE_CLASS(oc);
> diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
> index 3b86724cf007..851140ad0520 100644
> --- a/include/hw/core/boards.h
> +++ b/include/hw/core/boards.h
> @@ -36,6 +36,16 @@ const char *machine_default_cpu_type(const MachineState *ms);
> * @mc: Machine class
> */
> const char *machine_class_default_cpu_type(MachineClass *mc);
> +/**
> + * machine_class_set_name: Set the -M name when it differs from the QOM type
> + * @mc: Machine class
> + * @name: Name used by -M lookup, help, and migration
> + *
> + * machine_class_base_init sets MachineClass::name from the QOM type with
> + * the -machine suffix removed. Call this from board class_init when the
> + * CLI name must stay stable after the QOM type is uniquified.
> + */
> +void machine_class_set_name(MachineClass *mc, const char *name);
add machine_class_set_name() to the comment example around line 484:
Add after the existing mc->desc line in the example:
* machine_class_set_name(mc, "virt-" MACHINE_VER_STR(__VA_ARGS__)); \
And update the example's type name from "virt" to show a prefixed name like
"arm-virt" so it matches the real usage pattern.
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/9] hw/or1k/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 4/9] hw/or1k/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
> Set TYPE_VIRT_MACHINE to MACHINE_TYPE_NAME("or1k-virt") so OpenRISC
> virt no longer collides with other virt-machine types in one process.
> Keep the -M / help / migration name as virt via
> machine_class_set_name().
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> Message-ID: <20260922215533.641-5-luoyonggang@gmail.com>
>
> diff --git a/hw/or1k/virt.c b/hw/or1k/virt.c
> index 2ff5c084a2b7..35884252379c 100644
> --- a/hw/or1k/virt.c
> +++ b/hw/or1k/virt.c
> @@ -34,7 +34,7 @@
> #define VIRT_CPUS_MAX 4
> #define VIRT_CLK_MHZ 20000000
>
> -#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
> +#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("or1k-virt")
> #define VIRT_MACHINE(obj) \
> OBJECT_CHECK(OR1KVirtState, (obj), TYPE_VIRT_MACHINE)
While at it, rename it to TYPE_OR1K_VIRT_MACHINE?
>
> @@ -548,6 +548,7 @@ static void openrisc_virt_machine_init(ObjectClass *oc, const void *data)
> MachineClass *mc = MACHINE_CLASS(oc);
>
> mc->desc = "or1k virtual machine";
> + machine_class_set_name(mc, "virt");
> mc->init = openrisc_virt_init;
> mc->max_cpus = VIRT_CPUS_MAX;
> mc->is_default = false;
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 2/9] hw/riscv/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 2/9] hw/riscv/virt: use unique QOM name Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:25 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Use TYPE_RISCV_VIRT_MACHINE so the RISC-V virt QOM type does not
> collide with ARM virt in a combined qemu-system binary. Keep the
> -M / help / migration name as virt via machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 3/9] hw/arm/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 3/9] hw/arm/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:26 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Set TYPE_VIRT_MACHINE to MACHINE_TYPE_NAME("arm-virt") so ARM virt
> no longer collides with other virt-machine types in one process.
> Keep the -M / help / migration name as virt-* via
> machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 7/9] hw/m68k/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 7/9] hw/m68k/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:30 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Set the parent and versioned QOM types to m68k-virt so M68K virt no
> longer collides with other virt-machine types in one process. Keep
> the -M / help / migration name as virt-* via
> machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 5/9] hw/hexagon/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 5/9] hw/hexagon/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:28 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Set TYPE_HEXAGON_VIRT_MACHINE to MACHINE_TYPE_NAME("hexagon-virt") so
> Hexagon virt no longer collides with other virt-machine types in one
> process. Keep the -M / help / migration name as virt via
> machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 6/9] hw/loongarch/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 6/9] hw/loongarch/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:29 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Set TYPE_LOONGARCH_VIRT_MACHINE to MACHINE_TYPE_NAME("loongarch-virt")
> so LoongArch virt no longer collides with other virt-machine types in
> one process. Keep the -M / help / migration name as virt-* via
> machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 8/9] hw/xtensa/virt: use unique QOM name
2026-09-22 21:55 ` [PATCH v2 8/9] hw/xtensa/virt: " Yonggang Luo
@ 2026-09-23 10:56 ` marcandre.lureau
0 siblings, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:31 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> Register the board as xtensa-virt so Xtensa virt no longer collides
> with other virt-machine types in one process. Keep the -M / help /
> migration name as virt via machine_class_set_name().
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines
2026-09-22 21:55 ` [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines Yonggang Luo
2026-09-23 8:33 ` Daniel P. Berrangé
@ 2026-09-23 10:56 ` marcandre.lureau
1 sibling, 0 replies; 22+ messages in thread
From: marcandre.lureau @ 2026-09-23 10:56 UTC (permalink / raw)
To: Yonggang Luo
Cc: qemu-devel, Philippe Mathieu-Daudé, Bibo Mao, Xianglai Li,
Laurent Vivier, Palmer Dabbelt, Chao Liu, qemu-arm,
Alistair Francis, Laurent Vivier, Pierrick Bouvier, Weiwei Li,
Daniel Henrique Barboza, Zhao Liu, Peter Maydell, Fabiano Rosas,
Song Gao, Markus Armbruster, Liu Zhiwei, qemu-riscv,
Stafford Horne, Brian Cain, Jiaxun Yang, Max Filippov,
Philippe Mathieu-Daude, Daniel P. Berrangé, Paolo Bonzini,
Eric Blake
On Wed, 23 Sep 2026 05:55:32 +0800, Yonggang Luo <luoyonggang@gmail.com> wrote:
> query-machines returned only the -M name, so management apps inferred
> the QOM type as that name plus "-machine". A prefixed type such as
> arm-virt-11.1-machine no longer matches -M virt-11.1. Return the QOM
> type in MachineInfo typename from object_class_get_name() in
> qmp_query_machines(). test_query_machines_typename checks that
> qom-list-properties accepts it.
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2026-09-23 11:00 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22 21:55 [PATCH v2 0/9] machine: uniquify virt QOM names Yonggang Luo
2026-09-22 21:55 ` [PATCH v2 1/9] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-23 5:01 ` Pierrick Bouvier
2026-09-23 5:56 ` Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 2/9] hw/riscv/virt: use unique QOM name Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 3/9] hw/arm/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 4/9] hw/or1k/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 5/9] hw/hexagon/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 6/9] hw/loongarch/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 7/9] hw/m68k/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 8/9] hw/xtensa/virt: " Yonggang Luo
2026-09-23 10:56 ` marcandre.lureau
2026-09-22 21:55 ` [PATCH v2 9/9] qapi: return MachineInfo typename from query-machines Yonggang Luo
2026-09-23 8:33 ` Daniel P. Berrangé
2026-09-23 10:56 ` marcandre.lureau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.