Commit d85dc283fa87353be10b11b463196d10eb49ca41
1 parent
f19412a2
Disable KVM support if the kernel modules have broken memory slot handling
Prior to kvm-80, memory slot deletion was broken in the KVM kernel modules. In kvm-81, a new capability is introduced to signify that this problem has been fixed. Since we rely on being able to delete memory slots, refuse to work with any kernel module that does not have this capability present. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5960 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
17 additions
and
1 deletions
configure
... | ... | @@ -933,7 +933,8 @@ if test "$kvm" = "yes" ; then |
933 | 933 | KVM_API_VERSION < 12 || \ |
934 | 934 | KVM_API_VERSION > 12 || \ |
935 | 935 | !defined(KVM_CAP_USER_MEMORY) || \ |
936 | - !defined(KVM_CAP_SET_TSS_ADDR) | |
936 | + !defined(KVM_CAP_SET_TSS_ADDR) || \ | |
937 | + !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS) | |
937 | 938 | #error Invalid KVM version |
938 | 939 | #endif |
939 | 940 | int main(void) { return 0; } | ... | ... |
kvm-all.c
... | ... | @@ -283,6 +283,21 @@ int kvm_init(int smp_cpus) |
283 | 283 | goto err; |
284 | 284 | } |
285 | 285 | |
286 | + /* There was a nasty bug in < kvm-80 that prevents memory slots from being | |
287 | + * destroyed properly. Since we rely on this capability, refuse to work | |
288 | + * with any kernel without this capability. */ | |
289 | + ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, | |
290 | + KVM_CAP_DESTROY_MEMORY_REGION_WORKS); | |
291 | + if (ret <= 0) { | |
292 | + if (ret == 0) | |
293 | + ret = -EINVAL; | |
294 | + | |
295 | + fprintf(stderr, | |
296 | + "KVM kernel module broken (DESTROY_MEMORY_REGION)\n" | |
297 | + "Please upgrade to at least kvm-81.\n"); | |
298 | + goto err; | |
299 | + } | |
300 | + | |
286 | 301 | ret = kvm_arch_init(s, smp_cpus); |
287 | 302 | if (ret < 0) |
288 | 303 | goto err; | ... | ... |