kvm tools: Add kvm__has_cap() to check whether a cap is available on the host

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Sasha Levin
2011-12-14 08:37:25 +02:00
committed by Will Deacon
parent a7518f0579
commit 6930e42fa2
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -81,4 +81,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 */
+5
View File
@@ -520,3 +520,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;
}