summaryrefslogtreecommitdiff
path: root/libkvm
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2008-08-22 20:03:34 -0300
committerAvi Kivity <avi@qumranet.com>2008-08-25 13:19:52 +0300
commit501797e19c7282e9579686bd80feff3754a7ccca (patch)
tree2bd2924b07642eb0e3f5f6ac4cffe51147a033ea /libkvm
parentc80d19d7f77521bb55c7a36deb5f559ccebce22c (diff)
kvm: libkvm: add kvm_has_sync_mmu
This patch adds a kvm_has_sync_mmu routine to libkvm. This allows userspace to query the existence of mmu notifiers which is important for ballooning since madvise() is not safe from userspace without it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'libkvm')
-rw-r--r--libkvm/libkvm.c9
-rw-r--r--libkvm/libkvm.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index ad7f5a53..fb0aa434 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -1053,6 +1053,15 @@ int kvm_pit_in_kernel(kvm_context_t kvm)
return kvm->pit_in_kernel;
}
+int kvm_has_sync_mmu(kvm_context_t kvm)
+{
+ int r = 0;
+#ifdef KVM_CAP_SYNC_MMU
+ r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_MMU);
+#endif
+ return r;
+}
+
int kvm_init_coalesced_mmio(kvm_context_t kvm)
{
int r = 0;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index 9f06fcc3..346eedfc 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -528,6 +528,8 @@ int kvm_dirty_pages_log_reset(kvm_context_t kvm);
*/
int kvm_irqchip_in_kernel(kvm_context_t kvm);
+int kvm_has_sync_mmu(kvm_context_t kvm);
+
#ifdef KVM_CAP_IRQCHIP
/*!
* \brief Dump in kernel IRQCHIP contents