Pablo Greco e6a3ae
From 9a920701b3d2d78612bc454c407cf7b0d01f51c6 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Date: Mon, 22 Jul 2019 18:22:05 +0100
Pablo Greco e6a3ae
Subject: [PATCH 24/39] target/i386: kvm: add VMX migration blocker
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190722182220.19374-4-pbonzini@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 89621
Pablo Greco e6a3ae
O-Subject: [RHEL-8.1.0 PATCH qemu-kvm v3 03/18] target/i386: kvm: add VMX migration blocker
Pablo Greco e6a3ae
Bugzilla: 1689269
Pablo Greco e6a3ae
RH-Acked-by: Peter Xu <zhexu@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Nested VMX does not support live migration yet.  Add a blocker
Pablo Greco e6a3ae
until that is worked out.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Nested SVM only does not support it, but unfortunately it is
Pablo Greco e6a3ae
enabled by default for -cpu host so we cannot really disable it.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit d98f26073bebddcd3da0ba1b86c3a34e840c0fb8)
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 target/i386/kvm.c | 12 ++++++++++++
Pablo Greco e6a3ae
 1 file changed, 12 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
Pablo Greco e6a3ae
index 8a4d31d..d414187 100644
Pablo Greco e6a3ae
--- a/target/i386/kvm.c
Pablo Greco e6a3ae
+++ b/target/i386/kvm.c
Pablo Greco e6a3ae
@@ -772,6 +772,7 @@ static int hyperv_handle_properties(CPUState *cs)
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 static Error *invtsc_mig_blocker;
Pablo Greco e6a3ae
+static Error *vmx_mig_blocker;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #define KVM_MAX_CPUID_ENTRIES  100
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -1115,6 +1116,17 @@ int kvm_arch_init_vcpu(CPUState *cs)
Pablo Greco e6a3ae
                                   !!(c->ecx & CPUID_EXT_SMX);
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+    if ((env->features[FEAT_1_ECX] & CPUID_EXT_VMX) && !vmx_mig_blocker) {
Pablo Greco e6a3ae
+        error_setg(&vmx_mig_blocker,
Pablo Greco e6a3ae
+                   "Nested VMX virtualization does not support live migration yet");
Pablo Greco e6a3ae
+        r = migrate_add_blocker(vmx_mig_blocker, &local_err);
Pablo Greco e6a3ae
+        if (local_err) {
Pablo Greco e6a3ae
+            error_report_err(local_err);
Pablo Greco e6a3ae
+            error_free(vmx_mig_blocker);
Pablo Greco e6a3ae
+            return r;
Pablo Greco e6a3ae
+        }
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
     if (env->mcg_cap & MCG_LMCE_P) {
Pablo Greco e6a3ae
         has_msr_mcg_ext_ctl = has_msr_feature_control = true;
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae