All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] machine: uniquify virt QOM names
@ 2026-09-18  0:06 Yonggang Luo
  2026-09-18  0:06 ` [PATCH 1/8] machine: allow -M name to differ from QOM type Yonggang Luo
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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.

Yonggang Luo (8):
  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

 hw/arm/virt.c               |  3 ++-
 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 +-
 system/vl.c                 |  8 +++-----
 14 files changed, 39 insertions(+), 18 deletions(-)

-- 
2.52.0.windows.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/8] machine: allow -M name to differ from QOM type
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-21 14:19   ` Daniel P. Berrangé
  2026-09-18  0:06 ` [PATCH 2/8] hw/riscv/virt: use unique QOM name Yonggang Luo
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

- 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>
---
 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 8939ae16666..3cca243c3cb 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 dba465efc2c..d397ffb3c2c 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 9bd7664b85c..456b3a8e10d 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] 12+ messages in thread

* [PATCH 2/8] hw/riscv/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
  2026-09-18  0:06 ` [PATCH 1/8] machine: allow -M name to differ from QOM type Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  0:06 ` [PATCH 3/8] hw/arm/virt: " Yonggang Luo
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* [PATCH 3/8] hw/arm/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
  2026-09-18  0:06 ` [PATCH 1/8] machine: allow -M name to differ from QOM type Yonggang Luo
  2026-09-18  0:06 ` [PATCH 2/8] hw/riscv/virt: use unique QOM name Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  0:06 ` [PATCH 4/8] hw/or1k/virt: " Yonggang Luo
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* [PATCH 4/8] hw/or1k/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
                   ` (2 preceding siblings ...)
  2026-09-18  0:06 ` [PATCH 3/8] hw/arm/virt: " Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  0:06 ` [PATCH 5/8] hw/hexagon/virt: " Yonggang Luo
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* [PATCH 5/8] hw/hexagon/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
                   ` (3 preceding siblings ...)
  2026-09-18  0:06 ` [PATCH 4/8] hw/or1k/virt: " Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  3:26   ` Brian Cain
  2026-09-18  0:06 ` [PATCH 6/8] hw/loongarch/virt: " Yonggang Luo
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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>
---
 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] 12+ messages in thread

* [PATCH 6/8] hw/loongarch/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
                   ` (4 preceding siblings ...)
  2026-09-18  0:06 ` [PATCH 5/8] hw/hexagon/virt: " Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  0:06 ` [PATCH 7/8] hw/m68k/virt: " Yonggang Luo
  2026-09-18  0:06 ` [PATCH 8/8] hw/xtensa/virt: " Yonggang Luo
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* [PATCH 7/8] hw/m68k/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
                   ` (5 preceding siblings ...)
  2026-09-18  0:06 ` [PATCH 6/8] hw/loongarch/virt: " Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  2026-09-18  0:06 ` [PATCH 8/8] hw/xtensa/virt: " Yonggang Luo
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* [PATCH 8/8] hw/xtensa/virt: use unique QOM name
  2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
                   ` (6 preceding siblings ...)
  2026-09-18  0:06 ` [PATCH 7/8] hw/m68k/virt: " Yonggang Luo
@ 2026-09-18  0:06 ` Yonggang Luo
  7 siblings, 0 replies; 12+ messages in thread
From: Yonggang Luo @ 2026-09-18  0:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Brian Cain,
	Laurent Vivier, Peter Maydell, Pierrick Bouvier, Paolo Bonzini,
	Song Gao, Daniel Henrique Barboza, Bibo Mao, Chao Liu,
	Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

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] 12+ messages in thread

* Re: [PATCH 5/8] hw/hexagon/virt: use unique QOM name
  2026-09-18  0:06 ` [PATCH 5/8] hw/hexagon/virt: " Yonggang Luo
@ 2026-09-18  3:26   ` Brian Cain
  0 siblings, 0 replies; 12+ messages in thread
From: Brian Cain @ 2026-09-18  3:26 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel
  Cc: Xianglai Li, Weiwei Li, Alistair Francis, Stafford Horne,
	qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu, Laurent Vivier,
	Peter Maydell, Pierrick Bouvier, Paolo Bonzini, Song Gao,
	Daniel Henrique Barboza, Bibo Mao, Chao Liu, Palmer Dabbelt,
	Philippe Mathieu-Daude, Philippe Mathieu-Daudé, Liu Zhiwei,
	Max Filippov


On 9/17/2026 7:06 PM, Yonggang Luo 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().
>
> 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 */


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/8] machine: allow -M name to differ from QOM type
  2026-09-18  0:06 ` [PATCH 1/8] machine: allow -M name to differ from QOM type Yonggang Luo
@ 2026-09-21 14:19   ` Daniel P. Berrangé
  2026-09-21 14:50     ` Daniel P. Berrangé
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel P. Berrangé @ 2026-09-21 14:19 UTC (permalink / raw)
  To: Yonggang Luo
  Cc: qemu-devel, Xianglai Li, Weiwei Li, Alistair Francis,
	Stafford Horne, qemu-riscv, qemu-arm, Jiaxun Yang, Zhao Liu,
	Brian Cain, Laurent Vivier, Peter Maydell, Pierrick Bouvier,
	Paolo Bonzini, Song Gao, Daniel Henrique Barboza, Bibo Mao,
	Chao Liu, Palmer Dabbelt, Philippe Mathieu-Daude,
	Philippe Mathieu-Daudé, Liu Zhiwei, Max Filippov

On Fri, Sep 18, 2026 at 08:06:32AM +0800, 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>
> ---
>  hw/core/machine.c        |  6 ++++++
>  include/hw/core/boards.h | 12 +++++++++++-
>  system/vl.c              |  8 +++-----
>  3 files changed, 20 insertions(+), 6 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] 12+ messages in thread

* Re: [PATCH 1/8] machine: allow -M name to differ from QOM type
  2026-09-21 14:19   ` Daniel P. Berrangé
@ 2026-09-21 14:50     ` Daniel P. Berrangé
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel P. Berrangé @ 2026-09-21 14:50 UTC (permalink / raw)
  To: Yonggang Luo, qemu-devel, Xianglai Li, Weiwei Li,
	Alistair Francis, Stafford Horne, qemu-riscv, qemu-arm,
	Jiaxun Yang, Zhao Liu, Brian Cain, Laurent Vivier, Peter Maydell,
	Pierrick Bouvier, Paolo Bonzini, Song Gao,
	Daniel Henrique Barboza, Bibo Mao, Chao Liu, Palmer Dabbelt,
	Philippe Mathieu-Daude, Philippe Mathieu-Daudé, Liu Zhiwei,
	Max Filippov

On Mon, Sep 21, 2026 at 03:19:16PM +0100, Daniel P. Berrangé wrote:
> On Fri, Sep 18, 2026 at 08:06:32AM +0800, 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>
> > ---
> >  hw/core/machine.c        |  6 ++++++
> >  include/hw/core/boards.h | 12 +++++++++++-
> >  system/vl.c              |  8 +++-----
> >  3 files changed, 20 insertions(+), 6 deletions(-)
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

When I apply this series and test libvirt, libvirt crashes because
it sees a machine name "virt-11.1" and then to introspect it, it
calls

  qom-list-properties type=virt-11.1-machine

this doesn't work as the actual type name is

  qom-list-properties type=arm-virt-11.1-machine

The problem we put ourselves in here is that 'query-machines' only
returns the machine name, and not the typename, so mgmt apps have
to infer that    typename==$machinename + "-machine".

Libvirt shouldn't crash of course and the fix for the crash it
"easy", but when fixing it, then libvirt simply won't be able to
introspect the machine, as it doesn't name the naming convention to
get the typename out.


I think we probably need to extend 'query-machines' so that it
includes a @typename field, so mgmt apps don't have to make the
bad assumptions about naming conventions for types.

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] 12+ messages in thread

end of thread, other threads:[~2026-09-21 14:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18  0:06 [PATCH 0/8] machine: uniquify virt QOM names Yonggang Luo
2026-09-18  0:06 ` [PATCH 1/8] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-21 14:19   ` Daniel P. Berrangé
2026-09-21 14:50     ` Daniel P. Berrangé
2026-09-18  0:06 ` [PATCH 2/8] hw/riscv/virt: use unique QOM name Yonggang Luo
2026-09-18  0:06 ` [PATCH 3/8] hw/arm/virt: " Yonggang Luo
2026-09-18  0:06 ` [PATCH 4/8] hw/or1k/virt: " Yonggang Luo
2026-09-18  0:06 ` [PATCH 5/8] hw/hexagon/virt: " Yonggang Luo
2026-09-18  3:26   ` Brian Cain
2026-09-18  0:06 ` [PATCH 6/8] hw/loongarch/virt: " Yonggang Luo
2026-09-18  0:06 ` [PATCH 7/8] hw/m68k/virt: " Yonggang Luo
2026-09-18  0:06 ` [PATCH 8/8] hw/xtensa/virt: " Yonggang Luo

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.