This introduces a globally unique QOM typename 'hexagon-virt' for
the virt machine type.

An alias is added to resolve existing convenience name 'virt'.

Signed-off-by: Daniel P. Berrangé <[email protected]>
---
 hw/hexagon/virt.c         | 6 ++++++
 include/hw/hexagon/virt.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c
index 3327e28d121..645a3146810 100644
--- a/hw/hexagon/virt.c
+++ b/hw/hexagon/virt.c
@@ -19,6 +19,7 @@
 #include "qemu/units.h"
 #include "machine_cfg_v68n_1024.h.inc"
 #include "system/device_tree.h"
+#include "qom/object_interfaces.h"
 
 enum {
     VIRT_UART0,
@@ -139,7 +140,12 @@ static void virt_init(MachineState *ms)
 static void virt_class_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    AliasedClass *alc = ALIASED_CLASS(mc);
+    static const char *const aliases[] = {
+        MACHINE_TYPE_NAME("virt"), NULL,
+    };
 
+    alc->aliases = aliases;
     mc->desc = "Hexagon Virtual Machine";
     mc->init = virt_init;
     mc->default_cpu_type = HEXAGON_CPU_TYPE_NAME("v68");
diff --git a/include/hw/hexagon/virt.h b/include/hw/hexagon/virt.h
index dc9f22a83c4..74763028b6b 100644
--- a/include/hw/hexagon/virt.h
+++ b/include/hw/hexagon/virt.h
@@ -20,7 +20,7 @@ struct HexagonVirtMachineState {
     MemoryRegion tcm;
 };
 
-#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.56.1


Reply via email to