summaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:33:06 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:33:06 +0000
commit6503cbb0106628363b5fce1eb613a57ad98ddc72 (patch)
tree2f790c4ead1b6829a8433b37ba95e9b632d5f45e /kvm-all.c
parentb8e1a69ec5eeb2bbdfa55e4d96b3d563176eb639 (diff)
downloadqemu-6503cbb0106628363b5fce1eb613a57ad98ddc72.tar.gz
qemu-6503cbb0106628363b5fce1eb613a57ad98ddc72.tar.bz2
qemu-6503cbb0106628363b5fce1eb613a57ad98ddc72.zip
Add virtio-balloon support
This adds a VirtIO based balloon driver. It uses madvise() to actually balloon the memory when possible. Until 2.6.27, KVM forced memory pinning so we must disable ballooning unless the kernel actually supports it when using KVM. It's always safe when using TCG. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5874 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 39f826bbeb..69ca46b1af 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -549,3 +549,15 @@ int kvm_vcpu_ioctl(CPUState *env, int type, ...)
return ret;
}
+
+int kvm_has_sync_mmu(void)
+{
+ KVMState *s = kvm_state;
+
+#ifdef KVM_CAP_SYNC_MMU
+ if (kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_MMU) > 0)
+ return 1;
+#endif
+
+ return 0;
+}