summaryrefslogtreecommitdiffstats
path: root/kvm-all.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-07-14 19:15:15 +0200
committerAlexander Graf <agraf@suse.de>2014-09-08 12:50:51 +0200
commit7d0a07fa926436baf1238dcf68a55ea96cf5b9ab (patch)
treeaf01a6fc89d8d623ee1a4a6a33e2ab28fca9907f /kvm-all.c
parent4bc02e230d1e0fd41d2a892d81dcad56e3b3702d (diff)
downloadhqemu-7d0a07fa926436baf1238dcf68a55ea96cf5b9ab.zip
hqemu-7d0a07fa926436baf1238dcf68a55ea96cf5b9ab.tar.gz
KVM: Add helper to run KVM_CHECK_EXTENSION on vm fd
We now can call KVM_CHECK_EXTENSION on the kvm fd or on the vm fd, whereas the vm version is more accurate when it comes to PPC KVM. Add a helper to make the vm version available that falls back to the non-vm variant if the vm one is not available yet to stay compatible. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kvm-all.c b/kvm-all.c
index b240bf8..b1cf703 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -493,6 +493,19 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
return ret;
}
+int kvm_vm_check_extension(KVMState *s, unsigned int extension)
+{
+ int ret;
+
+ ret = kvm_vm_ioctl(s, KVM_CHECK_EXTENSION, extension);
+ if (ret < 0) {
+ /* VM wide version not implemented, use global one instead */
+ ret = kvm_check_extension(s, extension);
+ }
+
+ return ret;
+}
+
static int kvm_set_ioeventfd_mmio(int fd, hwaddr addr, uint32_t val,
bool assign, uint32_t size, bool datamatch)
{
OpenPOWER on IntegriCloud