@@ -17,5 +17,6 @@
#define HWCAP_LOONGSON_MMI (1 << 11)
#define HWCAP_LOONGSON_EXT (1 << 12)
#define HWCAP_LOONGSON_EXT2 (1 << 13)
+#define HWCAP_MIPS_VZ (1 << 14)
#endif /* _UAPI_ASM_HWCAP_H */
@@ -2242,8 +2242,10 @@ void cpu_probe(void)
if (cpu_has_loongson_ext2)
elf_hwcap |= HWCAP_LOONGSON_EXT2;
- if (cpu_has_vz)
+ if (cpu_has_vz) {
cpu_probe_vz(c);
+ elf_hwcap |= HWCAP_MIPS_VZ;
+ }
cpu_probe_vmbits(c);
@@ -19,6 +19,7 @@
#include <linux/sched/signal.h>
#include <linux/fs.h>
#include <linux/memblock.h>
+#include <linux/cpufeature.h>
#include <asm/fpu.h>
#include <asm/page.h>
@@ -1742,7 +1743,7 @@ static void __exit kvm_mips_exit(void)
unregister_die_notifier(&kvm_mips_csr_die_notifier);
}
-module_init(kvm_mips_init);
+module_cpu_feature_match(MIPS_VZ, kvm_mips_init);
module_exit(kvm_mips_exit);
EXPORT_TRACEPOINT_SYMBOL(kvm_exit);
Currently, the module_init of kvm_mips_init cannot force the kvm modules insmod when startup system. Add new feature CPU_MIPS_VZ in elf_hwcap to support KVM auto probe when hardware virtualization supported. Signed-off-by: Xing Li <lixing@loongson.cn> --- arch/mips/include/uapi/asm/hwcap.h | 1 + arch/mips/kernel/cpu-probe.c | 4 +++- arch/mips/kvm/mips.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-)