The Xtensa virt machine uses the QOM name virt-machine, which other
targets register as well. Register it only when the selected target
is Xtensa, via target_xtensa().

Reviewed-by: Pierrick Bouvier <[email protected]>
Signed-off-by: Yonggang Luo <[email protected]>
---
 hw/xtensa/virt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/xtensa/virt.c b/hw/xtensa/virt.c
index 8c8fdad72f0..962646ba98d 100644
--- a/hw/xtensa/virt.c
+++ b/hw/xtensa/virt.c
@@ -29,6 +29,7 @@
 #include "qapi/error.h"
 #include "system/reset.h"
 #include "hw/core/boards.h"
+#include "qemu/target-info.h"
 #include "hw/core/loader.h"
 #include "hw/pci-host/gpex.h"
 #include "net/net.h"
@@ -131,6 +132,7 @@ static const TypeInfo xtensa_virt_machine_typeinfo = {
     .parent     = TYPE_MACHINE,
     .class_init = xtensa_virt_machine_class_init,
     .instance_size = sizeof(MachineState),
+    .is_available = target_xtensa,
 };
 
 static void xtensa_virt_machine_register_types(void)
-- 
2.55.0.windows.3


Reply via email to