diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e79c54034bcd..7495ce347344 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 | ||
853 | static 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 | |||
853 | static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, | 866 | static 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 */ |
@@ -2703,8 +2717,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
2703 | int r; | 2717 | int r; |
2704 | int cpu; | 2718 | int cpu; |
2705 | 2719 | ||
2706 | kvm_init_debug(); | ||
2707 | |||
2708 | r = kvm_arch_init(opaque); | 2720 | r = kvm_arch_init(opaque); |
2709 | if (r) | 2721 | if (r) |
2710 | goto out_fail; | 2722 | goto out_fail; |
@@ -2771,6 +2783,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
2771 | kvm_preempt_ops.sched_in = kvm_sched_in; | 2783 | kvm_preempt_ops.sched_in = kvm_sched_in; |
2772 | kvm_preempt_ops.sched_out = kvm_sched_out; | 2784 | kvm_preempt_ops.sched_out = kvm_sched_out; |
2773 | 2785 | ||
2786 | kvm_init_debug(); | ||
2787 | |||
2774 | return 0; | 2788 | return 0; |
2775 | 2789 | ||
2776 | out_free: | 2790 | out_free: |
@@ -2793,7 +2807,6 @@ out_free_0: | |||
2793 | out: | 2807 | out: |
2794 | kvm_arch_exit(); | 2808 | kvm_arch_exit(); |
2795 | out_fail: | 2809 | out_fail: |
2796 | kvm_exit_debug(); | ||
2797 | return r; | 2810 | return r; |
2798 | } | 2811 | } |
2799 | EXPORT_SYMBOL_GPL(kvm_init); | 2812 | EXPORT_SYMBOL_GPL(kvm_init); |
@@ -2801,6 +2814,7 @@ EXPORT_SYMBOL_GPL(kvm_init); | |||
2801 | void kvm_exit(void) | 2814 | void kvm_exit(void) |
2802 | { | 2815 | { |
2803 | tracepoint_synchronize_unregister(); | 2816 | tracepoint_synchronize_unregister(); |
2817 | kvm_exit_debug(); | ||
2804 | misc_deregister(&kvm_dev); | 2818 | misc_deregister(&kvm_dev); |
2805 | kmem_cache_destroy(kvm_vcpu_cache); | 2819 | kmem_cache_destroy(kvm_vcpu_cache); |
2806 | sysdev_unregister(&kvm_sysdev); | 2820 | sysdev_unregister(&kvm_sysdev); |
@@ -2810,7 +2824,6 @@ void kvm_exit(void) | |||
2810 | on_each_cpu(hardware_disable, NULL, 1); | 2824 | on_each_cpu(hardware_disable, NULL, 1); |
2811 | kvm_arch_hardware_unsetup(); | 2825 | kvm_arch_hardware_unsetup(); |
2812 | kvm_arch_exit(); | 2826 | kvm_arch_exit(); |
2813 | kvm_exit_debug(); | ||
2814 | free_cpumask_var(cpus_hardware_enabled); | 2827 | free_cpumask_var(cpus_hardware_enabled); |
2815 | __free_page(bad_page); | 2828 | __free_page(bad_page); |
2816 | } | 2829 | } |