aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
Diffstat (limited to 'accel')
-rw-r--r--accel/kvm/kvm-all.c8
-rw-r--r--accel/stubs/kvm-stub.c4
2 files changed, 7 insertions, 5 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 4f1997deec..f54a337c4d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -87,6 +87,7 @@ struct KVMState
#endif
int many_ioeventfds;
int intx_set_mask;
+ bool sync_mmu;
/* The man page (and posix) say ioctl numbers are signed int, but
* they're not. Linux, glibc and *BSD all treat ioctl numbers as
* unsigned, and treating them as signed here can break things */
@@ -1664,6 +1665,8 @@ static int kvm_init(MachineState *ms)
s->many_ioeventfds = kvm_check_many_ioeventfds();
+ s->sync_mmu = !!kvm_vm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
+
return 0;
err:
@@ -2130,10 +2133,9 @@ int kvm_device_access(int fd, int group, uint64_t attr,
return err;
}
-/* Return 1 on success, 0 on failure */
-int kvm_has_sync_mmu(void)
+bool kvm_has_sync_mmu(void)
{
- return kvm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
+ return kvm_state->sync_mmu;
}
int kvm_has_vcpu_events(void)
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 3965c528d3..c964af3e1c 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -64,9 +64,9 @@ int kvm_cpu_exec(CPUState *cpu)
abort();
}
-int kvm_has_sync_mmu(void)
+bool kvm_has_sync_mmu(void)
{
- return 0;
+ return false;
}
int kvm_has_many_ioeventfds(void)