On 10/27/2026 3:11 AM, Yonggang Luo wrote:
> 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).
> - When target_heterogeneous() is true, 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. Otherwise
> keep virt. Versioned ARM, LoongArch, and M68K boards keep virt-<ver>. Latest
> ARM virt still sets mc->alias to virt.
> This is for the review from Daniel:
> Link: https://lore.kernel.org/qemu-devel/ar_dK-_KUS3h2dkL@redhat.com/
> - 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.
> - Use target_heterogeneous() from the base. It still returns false, so
> qemu-system-<target> keeps the QOM type virt.
>
> Changes v3 -> v4:
> Rebased onto d73149283205645625bfa9fe029cfb68e4c4a9ae, which already
> includes target-info: add target_heterogeneous. The boards.h example
> uses arm-virt only when that returns true.
>
> Changes v2 -> v3:
> The versioned-machine example in boards.h now follows hw/arm/virt.c.
> machine_class_set_name() keeps the -M name as virt-<version>, the QOM type in
> the example is arm-virt, and the latest helper is DEFINE_VIRT_MACHINE_AS_LATEST.
>
> 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 (17):
> hw/riscv/virt: move virt TypeInfo into its type_init
> hw/arm/virt: move virt TypeInfo into its type_init
> hw/or1k/virt: move virt TypeInfo into its type_init
> hw/hexagon/virt: move virt TypeInfo into its type_init
> hw/loongarch/virt: move virt TypeInfo into its type_init
> hw/m68k/virt: move virt TypeInfo into its type_init
> hw/xtensa/virt: move virt TypeInfo into its type_init
> 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
> machine: match the versioned virt example to arm virt
>
> hw/arm/virt.c | 53 ++++++++++++++++--------------
> hw/core/machine-qmp-cmds.c | 1 +
> hw/core/machine.c | 6 ++++
> hw/hexagon/virt.c | 21 +++++++-----
> hw/loongarch/virt.c | 44 +++++++++++++------------
> hw/m68k/virt.c | 37 ++++++++++++---------
> hw/or1k/virt.c | 20 +++++++-----
> hw/riscv/virt.c | 26 +++++++--------
> hw/xtensa/virt.c | 20 ++++++++++--
> include/hw/arm/virt.h | 5 ++-
> include/hw/core/boards.h | 39 ++++++++++++++++------
> include/hw/hexagon/virt.h | 5 ++-
> include/hw/loongarch/virt.h | 5 ++-
> include/hw/riscv/virt.h | 5 ++-
> qapi/machine.json | 6 +++-
> system/vl.c | 8 ++---
> tests/qtest/qom-test.c | 65 +++++++++++++++++++++++++++++++++----
> 17 files changed, 247 insertions(+), 119 deletions(-)
>
If we follow approach to register types per target bucket, we don't need
to introduce anything specific at registration time, and we would still
be able to detect duplication and propose the list of available
alternatives automatically.
```
virt is an ambiguous machine type, please choose among:
- aarch64-virt
- riscv64-virt
```
Regards,
Pierrick