aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/kvm_host.h2
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c7
-rw-r--r--arch/x86/include/asm/kvm_host.h1
-rw-r--r--arch/x86/kvm/mmu.c5
-rw-r--r--virt/kvm/kvm_main.c3
5 files changed, 16 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 50ea12fd7bf5..572ad0141268 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -52,6 +52,8 @@
52 52
53struct kvm; 53struct kvm;
54extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 54extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
55extern int kvm_unmap_hva_range(struct kvm *kvm,
56 unsigned long start, unsigned long end);
55extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); 57extern int kvm_age_hva(struct kvm *kvm, unsigned long hva);
56extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 58extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
57extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 59extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 1a470bc28763..3c635c0616b0 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -870,6 +870,13 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
870 return 0; 870 return 0;
871} 871}
872 872
873int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
874{
875 if (kvm->arch.using_mmu_notifiers)
876 kvm_handle_hva_range(kvm, start, end, kvm_unmap_rmapp);
877 return 0;
878}
879
873static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 880static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
874 unsigned long gfn) 881 unsigned long gfn)
875{ 882{
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a3e9409e90b6..d4aab865606c 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -944,6 +944,7 @@ extern bool kvm_rebooting;
944 944
945#define KVM_ARCH_WANT_MMU_NOTIFIER 945#define KVM_ARCH_WANT_MMU_NOTIFIER
946int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); 946int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
947int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end);
947int kvm_age_hva(struct kvm *kvm, unsigned long hva); 948int kvm_age_hva(struct kvm *kvm, unsigned long hva);
948int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); 949int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
949void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); 950void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 7235b0c9587d..d2855f895fde 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1324,6 +1324,11 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
1324 return kvm_handle_hva(kvm, hva, 0, kvm_unmap_rmapp); 1324 return kvm_handle_hva(kvm, hva, 0, kvm_unmap_rmapp);
1325} 1325}
1326 1326
1327int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end)
1328{
1329 return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp);
1330}
1331
1327void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 1332void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
1328{ 1333{
1329 kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp); 1334 kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b3ce91c623e2..e2b1a159e5df 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -332,8 +332,7 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
332 * count is also read inside the mmu_lock critical section. 332 * count is also read inside the mmu_lock critical section.
333 */ 333 */
334 kvm->mmu_notifier_count++; 334 kvm->mmu_notifier_count++;
335 for (; start < end; start += PAGE_SIZE) 335 need_tlb_flush = kvm_unmap_hva_range(kvm, start, end);
336 need_tlb_flush |= kvm_unmap_hva(kvm, start);
337 need_tlb_flush |= kvm->tlbs_dirty; 336 need_tlb_flush |= kvm->tlbs_dirty;
338 /* we've to flush the tlb before the pages can be freed */ 337 /* we've to flush the tlb before the pages can be freed */
339 if (need_tlb_flush) 338 if (need_tlb_flush)