aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2009-09-23 14:47:18 -0400
committerAvi Kivity <avi@redhat.com>2009-10-04 11:04:53 -0400
commit3da0dd433dc399a8c0124d0614d82a09b6a49bce (patch)
tree233d2dc2915d996f8ba97321ea8bfe36fbd700f4 /virt
parent1403283acca398e244ece35741ad251c1feb5972 (diff)
KVM: add support for change_pte mmu notifiers
this is needed for kvm if it want ksm to directly map pages into its shadow page tables. [marcelo: cast pfn assignment to u64] Signed-off-by: Izik Eidus <ieidus@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e79c54034bcd..b7c78a403dc2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -850,6 +850,19 @@ static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
850 850
851} 851}
852 852
853static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
854 struct mm_struct *mm,
855 unsigned long address,
856 pte_t pte)
857{
858 struct kvm *kvm = mmu_notifier_to_kvm(mn);
859
860 spin_lock(&kvm->mmu_lock);
861 kvm->mmu_notifier_seq++;
862 kvm_set_spte_hva(kvm, address, pte);
863 spin_unlock(&kvm->mmu_lock);
864}
865
853static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, 866static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
854 struct mm_struct *mm, 867 struct mm_struct *mm,
855 unsigned long start, 868 unsigned long start,
@@ -929,6 +942,7 @@ static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
929 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, 942 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
930 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, 943 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end,
931 .clear_flush_young = kvm_mmu_notifier_clear_flush_young, 944 .clear_flush_young = kvm_mmu_notifier_clear_flush_young,
945 .change_pte = kvm_mmu_notifier_change_pte,
932 .release = kvm_mmu_notifier_release, 946 .release = kvm_mmu_notifier_release,
933}; 947};
934#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */ 948#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */