All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host
@ 2011-12-14  6:37 Sasha Levin
  2011-12-14  6:37 ` [PATCH 2/2] kvm tools: Don't use ioeventfds if no KVM_CAP_IOEVENTFD Sasha Levin
  2011-12-15  4:25 ` [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host Matt Evans
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2011-12-14  6:37 UTC (permalink / raw)
  To: penberg; +Cc: mingo, gorcunov, asias.hejun, kvm, matt, Sasha Levin

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/include/kvm/kvm.h |    2 ++
 tools/kvm/kvm.c             |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h
index 7159952..d24b70a 100644
--- a/tools/kvm/include/kvm/kvm.h
+++ b/tools/kvm/include/kvm/kvm.h
@@ -79,4 +79,6 @@ static inline void *guest_flat_to_host(struct kvm *kvm, unsigned long offset)
 	return kvm->ram_start + offset;
 }
 
+bool kvm__has_cap(struct kvm *kvm, u32 cap);
+
 #endif /* KVM__KVM_H */
diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index 35ca2c5..a2f7a89 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -517,3 +517,8 @@ void kvm__notify_paused(void)
 	mutex_lock(&pause_lock);
 	mutex_unlock(&pause_lock);
 }
+
+bool kvm__has_cap(struct kvm *kvm, u32 cap)
+{
+	return ioctl(kvm->sys_fd, KVM_CHECK_EXTENSION, cap) == 0;
+}
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-15  4:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-14  6:37 [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host Sasha Levin
2011-12-14  6:37 ` [PATCH 2/2] kvm tools: Don't use ioeventfds if no KVM_CAP_IOEVENTFD Sasha Levin
2011-12-15  0:52   ` Matt Evans
2011-12-15  4:25 ` [PATCH 1/2] kvm tools: Add kvm__has_cap() to check whether a cap is available on the host Matt Evans

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.