]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/kvm_host.h
[ARM] 5262/2: [AT91] Support for GPIO-connected buttons on SAM9260-EK board
[linux-2.6-omap-h63xx.git] / include / linux / kvm_host.h
index d220b4926c4ac0c405987a5c12af427abd529da4..8525afc53107faaaa993fa6ebae6c2d703eb718c 100644 (file)
@@ -121,6 +121,12 @@ struct kvm {
        struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
        struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
 #endif
+
+#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
+       struct mmu_notifier mmu_notifier;
+       unsigned long mmu_notifier_seq;
+       long mmu_notifier_count;
+#endif
 };
 
 /* The guest did something we don't support. */
@@ -168,6 +174,7 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
                                struct kvm_userspace_memory_region *mem,
                                struct kvm_memory_slot old,
                                int user_alloc);
+void kvm_arch_flush_shadow(struct kvm *kvm);
 gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
 struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
 unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
@@ -331,4 +338,22 @@ int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
 #define kvm_trace_cleanup() ((void)0)
 #endif
 
+#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
+static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
+{
+       if (unlikely(vcpu->kvm->mmu_notifier_count))
+               return 1;
+       /*
+        * Both reads happen under the mmu_lock and both values are
+        * modified under mmu_lock, so there's no need of smb_rmb()
+        * here in between, otherwise mmu_notifier_count should be
+        * read before mmu_notifier_seq, see
+        * mmu_notifier_invalidate_range_end write side.
+        */
+       if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
+               return 1;
+       return 0;
+}
+#endif
+
 #endif