cryptospore / rpms / qemu-kvm

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