target/i386: disable VMX features if nested=0
PATCH 1/1 target/i386: disable VMX features if nested=0
If kvm does not support VMX feature by nested=0, the kvm_vmx_basic can't get the right value from MSR_IA32_VMX_BASIC register, which make qemu coredump when qemu do KVM_SET_MSRS.
The coredump info:
error: failed to set MSR 0x480 to 0x0kvm_put_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
--- target/i386/kvm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/kvm.c +8 -0
@@ -2572,6 +2572,14 @@ static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f)uint64_t kvm_vmx_basic =kvm_arch_get_supported_msr_feature (kvm_state,MSR_IA32_VMX_BASIC ); +if (!kvm_vmx_basic) { +/* If the kernel does't support VMX feature(nested=0 in kvm) +* and kvm_vmx_basic will be 0. This will set 0 value to +* MSR_IA32_VMX_BASIC MSR. +*/ +return ; + } +uint64_t kvm_vmx_misc =kvm_arch_get_supported_msr_feature (kvm_state,MSR_IA32_VMX_MISC );
Signature · 1 line
2.17.1
Paolo Bonzini
AppliedQuoted 23 lines · Yang Zhong
If kvm does not support VMX feature by nested=0, the
kvm_vmx_basiccan't get the right value fromMSR_IA32_VMX_BASICregister, which make qemu coredump when qemu doKVM_SET_MSRS.The coredump info:
error: failed to set MSR0x480to0x0kvm_put_msrs: Assertion `ret ==cpu->kvm_msr_buf->nmsrs' failed.Signed-off-by Yang Zhong <[email protected]>--- target/i386/kvm.c | 8 ++++++++ 1 file changed, 8 insertions(+)target/i386/kvm.c +1
-0@@ -2572,6 +2572,14 @@ static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f)uint64_t kvm_vmx_basic =kvm_arch_get_supported_msr_feature (kvm_state,MSR_IA32_VMX_BASIC ); +if (!kvm_vmx_basic) {
target/i386/kvm.c static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f) · line 2585
Quoted 10 lines
target/i386/kvm.c +7
-0+/* If the kernel does't support VMX feature(nested=0 in kvm) +* and kvm_vmx_basic will be 0. This will set 0 value to +* MSR_IA32_VMX_BASIC MSR. +*/ +return ; + } +uint64_t kvm_vmx_misc =kvm_arch_get_supported_msr_feature (kvm_state,MSR_IA32_VMX_MISC );
Queued, thanks.
Paolo