summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure3
-rw-r--r--kvm-all.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/configure b/configure
index b90c47f0cf..13f6358d4c 100755
--- a/configure
+++ b/configure
@@ -933,7 +933,8 @@ if test "$kvm" = "yes" ; then
     KVM_API_VERSION < 12 || \
     KVM_API_VERSION > 12 || \
     !defined(KVM_CAP_USER_MEMORY) || \
-    !defined(KVM_CAP_SET_TSS_ADDR)
+    !defined(KVM_CAP_SET_TSS_ADDR) || \
+    !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
 #error Invalid KVM version
 #endif
 int main(void) { return 0; }
diff --git a/kvm-all.c b/kvm-all.c
index 69ca46b1af..8615bf6b27 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -283,6 +283,21 @@ int kvm_init(int smp_cpus)
         goto err;
     }
 
+    /* There was a nasty bug in < kvm-80 that prevents memory slots from being
+     * destroyed properly.  Since we rely on this capability, refuse to work
+     * with any kernel without this capability. */
+    ret = kvm_ioctl(s, KVM_CHECK_EXTENSION,
+                    KVM_CAP_DESTROY_MEMORY_REGION_WORKS);
+    if (ret <= 0) {
+        if (ret == 0)
+            ret = -EINVAL;
+
+        fprintf(stderr,
+                "KVM kernel module broken (DESTROY_MEMORY_REGION)\n"
+                "Please upgrade to at least kvm-81.\n");
+        goto err;
+    }
+
     ret = kvm_arch_init(s, smp_cpus);
     if (ret < 0)
         goto err;