diff options
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu_hv.c | 7 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.c | 5 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 3 |
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 | ||
53 | struct kvm; | 53 | struct kvm; |
54 | extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | 54 | extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); |
55 | extern int kvm_unmap_hva_range(struct kvm *kvm, | ||
56 | unsigned long start, unsigned long end); | ||
55 | extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); | 57 | extern int kvm_age_hva(struct kvm *kvm, unsigned long hva); |
56 | extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); | 58 | extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); |
57 | extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | 59 | extern 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 | ||
873 | int 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 | |||
873 | static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, | 880 | static 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 |
946 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | 946 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); |
947 | int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end); | ||
947 | int kvm_age_hva(struct kvm *kvm, unsigned long hva); | 948 | int kvm_age_hva(struct kvm *kvm, unsigned long hva); |
948 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); | 949 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); |
949 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | 950 | void 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 | ||
1327 | int 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 | |||
1327 | void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) | 1332 | void 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) |