diff options
author | Greg Kurz <groug@kaod.org> | 2017-09-21 18:00:53 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-10-02 14:38:06 +0200 |
commit | 62dd4edaaf859b60f74a51f2a526d4d3d85d0248 (patch) | |
tree | 253f8f5e5d2e3b5d40100a31944c40d0ede62107 /include/sysemu/kvm.h | |
parent | d4083f50e021f52addd02c9f83465937f8486556 (diff) |
kvm: check KVM_CAP_SYNC_MMU with kvm_vm_check_extension()
On a server-class ppc host, this capability depends on the KVM type,
ie, HV or PR. If both KVM are present in the kernel, we will always
get the HV specific value, even if we explicitely requested PR on
the command line.
This can have an impact if we're using hugepages or a balloon device.
Since we've already created the VM at the time any user calls
kvm_has_sync_mmu(), switching to kvm_vm_check_extension() is
enough to fix any potential issue.
It is okay for the other archs that also implement KVM_CAP_SYNC_MMU,
ie, mips, s390, x86 and arm, because they don't depend on the VM being
created or not.
While here, let's cache the state of this extension in a bool variable,
since it has several users in the code, as suggested by Thomas Huth.
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <150600965332.30533.14702405809647835716.stgit@bahia.lan>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/sysemu/kvm.h')
-rw-r--r-- | include/sysemu/kvm.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 3a458f50e9..bbf12a1723 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -207,7 +207,7 @@ extern KVMState *kvm_state; /* external API */ bool kvm_has_free_slot(MachineState *ms); -int kvm_has_sync_mmu(void); +bool kvm_has_sync_mmu(void); int kvm_has_vcpu_events(void); int kvm_has_robust_singlestep(void); int kvm_has_debugregs(void); |