WSL2-Linux-Kernel/arch/mips/kvm
Huacai Chen 15e9e35cd1 KVM: MIPS: Change the definition of kvm type
MIPS defines two kvm types:

 #define KVM_VM_MIPS_TE          0
 #define KVM_VM_MIPS_VZ          1

In Documentation/virt/kvm/api.rst it is said that "You probably want to
use 0 as machine type", which implies that type 0 be the "automatic" or
"default" type. And, in user-space libvirt use the null-machine (with
type 0) to detect the kvm capability, which returns "KVM not supported"
on a VZ platform.

I try to fix it in QEMU but it is ugly:
https://lists.nongnu.org/archive/html/qemu-devel/2020-08/msg05629.html

And Thomas Huth suggests me to change the definition of kvm type:
https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03281.html

So I define like this:

 #define KVM_VM_MIPS_AUTO        0
 #define KVM_VM_MIPS_VZ          1
 #define KVM_VM_MIPS_TE          2

Since VZ and TE cannot co-exists, using type 0 on a TE platform will
still return success (so old user-space tools have no problems on new
kernels); the advantage is that using type 0 on a VZ platform will not
return failure. So, the only problem is "new user-space tools use type
2 on old kernels", but if we treat this as a kernel bug, we can backport
this patch to old stable kernels.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Message-Id: <1599734031-28746-1-git-send-email-chenhc@lemote.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-11 13:22:52 -04:00
..
Kconfig MIPS: KVM: Limit Trap-and-Emulate to MIPS32R2 only 2020-07-10 03:15:38 -04:00
Makefile KVM: MIPS: Add Loongson-3 Virtual IPI interrupt support 2020-06-04 13:50:39 -04:00
callback.c
commpage.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
commpage.h
dyntrans.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
emulate.c MIPS: KVM: Convert a fallthrough comment to fallthrough 2020-08-10 04:11:48 -04:00
entry.c KVM: MIPS: Use lddir/ldpte instructions to lookup gpa_mm.pgd 2020-06-04 13:48:55 -04:00
fpu.S
hypcall.c
interrupt.c KVM: MIPS: Add more types of virtual interrupts 2020-06-04 13:49:13 -04:00
interrupt.h KVM: MIPS: Add more types of virtual interrupts 2020-06-04 13:49:13 -04:00
loongson_ipi.c KVM: MIPS: Add Loongson-3 Virtual IPI interrupt support 2020-06-04 13:50:39 -04:00
mips.c KVM: MIPS: Change the definition of kvm type 2020-09-11 13:22:52 -04:00
mmu.c KVM: Pass MMU notifier range flags to kvm_unmap_hva_range() 2020-08-21 18:03:47 -04:00
msa.S
stats.c
tlb.c MIPS: 2020-06-12 11:05:52 -07:00
trace.h
trap_emul.c KVM: MIPS: clean up redundant 'kvm_run' parameters 2020-07-10 04:26:41 -04:00
vz.c KVM: MIPS/VZ: Fix build error caused by 'kvm_run' cleanup 2020-08-11 07:19:41 -04:00