Merge branch 'kvm-updates/2.6.32' of git://git.kernel.org/pub/scm/virt/kvm/kvm

* 'kvm-updates/2.6.32' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: Prevent kvm_init from corrupting debugfs structures
KVM: MMU: fix pointer cast
KVM: use proper hrtimer function to retrieve expiration time

+15 -12
+1 -1
arch/x86/kvm/i8254.c
··· 116 * itself with the initial count and continues counting 117 * from there. 118 */ 119 - remaining = hrtimer_expires_remaining(&ps->pit_timer.timer); 120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining); 121 elapsed = mod_64(elapsed, ps->pit_timer.period); 122
··· 116 * itself with the initial count and continues counting 117 * from there. 118 */ 119 + remaining = hrtimer_get_remaining(&ps->pit_timer.timer); 120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining); 121 elapsed = mod_64(elapsed, ps->pit_timer.period); 122
+1 -1
arch/x86/kvm/lapic.c
··· 521 if (apic_get_reg(apic, APIC_TMICT) == 0) 522 return 0; 523 524 - remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer); 525 if (ktime_to_ns(remaining) < 0) 526 remaining = ktime_set(0, 0); 527
··· 521 if (apic_get_reg(apic, APIC_TMICT) == 0) 522 return 0; 523 524 + remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); 525 if (ktime_to_ns(remaining) < 0) 526 remaining = ktime_set(0, 0); 527
+10 -6
arch/x86/kvm/mmu.c
··· 748 return write_protected; 749 } 750 751 - static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 752 { 753 u64 *spte; 754 int need_tlb_flush = 0; ··· 764 return need_tlb_flush; 765 } 766 767 - static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 768 { 769 int need_flush = 0; 770 u64 *spte, new_spte; ··· 801 return 0; 802 } 803 804 - static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, u64 data, 805 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 806 - u64 data)) 807 { 808 int i, j; 809 int retval = 0; ··· 849 850 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 851 { 852 - kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp); 853 } 854 855 - static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 856 { 857 u64 *spte; 858 int young = 0;
··· 748 return write_protected; 749 } 750 751 + static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, 752 + unsigned long data) 753 { 754 u64 *spte; 755 int need_tlb_flush = 0; ··· 763 return need_tlb_flush; 764 } 765 766 + static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, 767 + unsigned long data) 768 { 769 int need_flush = 0; 770 u64 *spte, new_spte; ··· 799 return 0; 800 } 801 802 + static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, 803 + unsigned long data, 804 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 805 + unsigned long data)) 806 { 807 int i, j; 808 int retval = 0; ··· 846 847 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 848 { 849 + kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp); 850 } 851 852 + static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, 853 + unsigned long data) 854 { 855 u64 *spte; 856 int young = 0;
+3 -4
virt/kvm/kvm_main.c
··· 2717 int r; 2718 int cpu; 2719 2720 - kvm_init_debug(); 2721 - 2722 r = kvm_arch_init(opaque); 2723 if (r) 2724 goto out_fail; ··· 2783 kvm_preempt_ops.sched_in = kvm_sched_in; 2784 kvm_preempt_ops.sched_out = kvm_sched_out; 2785 2786 return 0; 2787 2788 out_free: ··· 2807 out: 2808 kvm_arch_exit(); 2809 out_fail: 2810 - kvm_exit_debug(); 2811 return r; 2812 } 2813 EXPORT_SYMBOL_GPL(kvm_init); ··· 2814 void kvm_exit(void) 2815 { 2816 tracepoint_synchronize_unregister(); 2817 misc_deregister(&kvm_dev); 2818 kmem_cache_destroy(kvm_vcpu_cache); 2819 sysdev_unregister(&kvm_sysdev); ··· 2824 on_each_cpu(hardware_disable, NULL, 1); 2825 kvm_arch_hardware_unsetup(); 2826 kvm_arch_exit(); 2827 - kvm_exit_debug(); 2828 free_cpumask_var(cpus_hardware_enabled); 2829 __free_page(bad_page); 2830 }
··· 2717 int r; 2718 int cpu; 2719 2720 r = kvm_arch_init(opaque); 2721 if (r) 2722 goto out_fail; ··· 2785 kvm_preempt_ops.sched_in = kvm_sched_in; 2786 kvm_preempt_ops.sched_out = kvm_sched_out; 2787 2788 + kvm_init_debug(); 2789 + 2790 return 0; 2791 2792 out_free: ··· 2807 out: 2808 kvm_arch_exit(); 2809 out_fail: 2810 return r; 2811 } 2812 EXPORT_SYMBOL_GPL(kvm_init); ··· 2815 void kvm_exit(void) 2816 { 2817 tracepoint_synchronize_unregister(); 2818 + kvm_exit_debug(); 2819 misc_deregister(&kvm_dev); 2820 kmem_cache_destroy(kvm_vcpu_cache); 2821 sysdev_unregister(&kvm_sysdev); ··· 2824 on_each_cpu(hardware_disable, NULL, 1); 2825 kvm_arch_hardware_unsetup(); 2826 kvm_arch_exit(); 2827 free_cpumask_var(cpus_hardware_enabled); 2828 __free_page(bad_page); 2829 }