Skip to contentSkip to conversation

hw/null-machine: Add the kvm_type() hook for MIPS

PATCH Superseded Huacai Chen 1 participant 1 message Aug 7, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/null-machine: Add the kvm_type() hook for MIPS

MIPS has two types of KVM: TE & VZ, and TE is the default type. Now, libvirt uses a null-machine to detect the kvm capability. In the MIPS case, it will return "KVM not supported" on a VZ platform by default. So, add the kvm_type() hook to the null-machine.

This seems not a very good solution, but I cannot do it better now.

---
 hw/core/Makefile.objs  | 2 +-
 hw/core/null-machine.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
hw/core/Makefile.objs +1 -1
index d8fee8e..2daba3f 100644
@@ -17,11 +17,11 @@ common-obj-$(CONFIG_SOFTMMU) += vm-change-state-handler.o
 common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o
 common-obj-$(CONFIG_SOFTMMU) += sysbus.o
 common-obj-$(CONFIG_SOFTMMU) += machine.o
-common-obj-$(CONFIG_SOFTMMU) += null-machine.o
 common-obj-$(CONFIG_SOFTMMU) += loader.o
 common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o
 common-obj-$(CONFIG_SOFTMMU) += numa.o
 common-obj-$(CONFIG_SOFTMMU) += clock-vmstate.o
+obj-$(CONFIG_SOFTMMU) += null-machine.o
 obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
 
 common-obj-$(CONFIG_XILINX_AXI) += stream.o
hw/core/null-machine.c +6 -0
index cb47d9d..1adba5d 100644
@@ -17,6 +17,9 @@
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 #include "hw/core/cpu.h"
+#ifdef TARGET_MIPS
+#include "kvm_mips.h"
+#endif
 
 static void machine_none_init(MachineState *mch)
 {
@@ -50,6 +53,9 @@ static void machine_none_machine_init(MachineClass *mc)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_sdcard = 1;
+#ifdef TARGET_MIPS
+    mc->kvm_type = mips_kvm_type;
+#endif
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)
Signature · 1 line
2.7.0