I read from here that vmx capability support on QEMU must be explicitly enabled by providing the +vmx option to the command but the problem is that it does not seem to work. In my system, the VMX feature is still undetected.
Command:
qemu-system-x86_64 -no-kvm -cpu qemu64,+vmx,-svm ...
In my guest OS, when I execute cpuid 1 I get ECX = 0x80802001; bit 5 = 0 meaning that my virtual CPU does not have VMX.
Is this a bug?
Or is there another way to enable the vmx feature in QEMU?
The following command works for me:
qemu-system-x86_64 -cpu host -kernel kernel/kernel -serial stdio -enable-kvm
-cpu host
makes QEMU report host CPU features inside the VM (so your CPU must support vmx)
-enable-kvm
is required by -cpu host
Even though according to this -cpu qemu64,+vmx
should work, it doesn't work for me either.
No, the vmx
flag is not supported in the processor emulation mode of QEMU. In order to use vmx
in QEMU, you must use KVM with QEMU (replacing -no-kvm
with -enable-kvm
); and your host processor must support vmx
.
In this document it shows the nested vmx instructions support in the Linux KVM; meaning this feature must be used with -enable-kvm
.
In my test the options -enable-kvm -cpu kvm64,+vmx
work, as the vmx
feature is detected in the guest OS.
来源:https://stackoverflow.com/questions/39154850/how-do-i-emulate-the-vmx-feature-with-qemu