summaryrefslogtreecommitdiffstats
path: root/include/linux/kvm_host.h
diff options
context:
space:
mode:
authorPaolo Bonzini2015-07-07 15:41:58 +0200
committerPaolo Bonzini2015-07-10 13:25:26 +0200
commit5544eb9b81940647b8fad1f251b37cbe2819ce44 (patch)
tree8a3e45817c9ba54102d4ad856cced515bc3bde62 /include/linux/kvm_host.h
parentKVM: VMX: fix vmwrite to invalid VMCS (diff)
downloadkernel-qcow2-linux-5544eb9b81940647b8fad1f251b37cbe2819ce44.tar.gz
kernel-qcow2-linux-5544eb9b81940647b8fad1f251b37cbe2819ce44.tar.xz
kernel-qcow2-linux-5544eb9b81940647b8fad1f251b37cbe2819ce44.zip
KVM: count number of assigned devices
If there are no assigned devices, the guest PAT are not providing any useful information and can be overridden to writeback; VMX always does this because it has the "IPAT" bit in its extended page table entries, but SVM does not have anything similar. Hook into VFIO and legacy device assignment so that they provide this information to KVM. Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r--include/linux/kvm_host.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 9564fd78c547..05e99b8ef465 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -734,6 +734,24 @@ static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
return false;
}
#endif
+#ifdef __KVM_HAVE_ARCH_ASSIGNED_DEVICE
+void kvm_arch_start_assignment(struct kvm *kvm);
+void kvm_arch_end_assignment(struct kvm *kvm);
+bool kvm_arch_has_assigned_device(struct kvm *kvm);
+#else
+static inline void kvm_arch_start_assignment(struct kvm *kvm)
+{
+}
+
+static inline void kvm_arch_end_assignment(struct kvm *kvm)
+{
+}
+
+static inline bool kvm_arch_has_assigned_device(struct kvm *kvm)
+{
+ return false;
+}
+#endif
static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
{