aboutsummaryrefslogtreecommitdiff
path: root/target/i386
diff options
context:
space:
mode:
Diffstat (limited to 'target/i386')
-rw-r--r--target/i386/kvm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index bf1655645b..1d10046a6c 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -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 doesn't support VMX feature (kvm_intel.nested=0),
+ * then kvm_vmx_basic will be 0 and KVM_SET_MSR will fail.
+ */
+ return;
+ }
+
uint64_t kvm_vmx_misc =
kvm_arch_get_supported_msr_feature(kvm_state,
MSR_IA32_VMX_MISC);