aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-10-21 19:26:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-10-21 19:26:15 -0400
commit422b42fa79fa2825dc7b272ee8d52aa4bac37113 (patch)
tree4e5b77896547dee638aed11991287a5595b5bbe2
parent1b7607030df6908901250b5d7de03ba74cca7d67 (diff)
parent0ea4ed8e948c30f88c824c973ee4b9529015fe65 (diff)
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
-rw-r--r--arch/x86/kvm/i8254.c2
-rw-r--r--arch/x86/kvm/lapic.c2
-rw-r--r--arch/x86/kvm/mmu.c16
-rw-r--r--virt/kvm/kvm_main.c7
4 files changed, 15 insertions, 12 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 82ad523b4901..144e7f60b5e2 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -116,7 +116,7 @@ static s64 __kpit_elapsed(struct kvm *kvm)
116 * itself with the initial count and continues counting 116 * itself with the initial count and continues counting
117 * from there. 117 * from there.
118 */ 118 */
119 remaining = hrtimer_expires_remaining(&ps->pit_timer.timer); 119 remaining = hrtimer_get_remaining(&ps->pit_timer.timer);
120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining); 120 elapsed = ps->pit_timer.period - ktime_to_ns(remaining);
121 elapsed = mod_64(elapsed, ps->pit_timer.period); 121 elapsed = mod_64(elapsed, ps->pit_timer.period);
122 122
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 7024224f0fc8..23c217692ea9 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -521,7 +521,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
521 if (apic_get_reg(apic, APIC_TMICT) == 0) 521 if (apic_get_reg(apic, APIC_TMICT) == 0)
522 return 0; 522 return 0;
523 523
524 remaining = hrtimer_expires_remaining(&apic->lapic_timer.timer); 524 remaining = hrtimer_get_remaining(&apic->lapic_timer.timer);
525 if (ktime_to_ns(remaining) < 0) 525 if (ktime_to_ns(remaining) < 0)
526 remaining = ktime_set(0, 0); 526 remaining = ktime_set(0, 0);
527 527
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 685a4ffac8e6..818b92ad82cf 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -748,7 +748,8 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
748 return write_protected; 748 return write_protected;
749} 749}
750 750
751static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 751static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
752 unsigned long data)
752{ 753{
753 u64 *spte; 754 u64 *spte;
754 int need_tlb_flush = 0; 755 int need_tlb_flush = 0;
@@ -763,7 +764,8 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
763 return need_tlb_flush; 764 return need_tlb_flush;
764} 765}
765 766
766static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 767static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
768 unsigned long data)
767{ 769{
768 int need_flush = 0; 770 int need_flush = 0;
769 u64 *spte, new_spte; 771 u64 *spte, new_spte;
@@ -799,9 +801,10 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
799 return 0; 801 return 0;
800} 802}
801 803
802static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, u64 data, 804static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
805 unsigned long data,
803 int (*handler)(struct kvm *kvm, unsigned long *rmapp, 806 int (*handler)(struct kvm *kvm, unsigned long *rmapp,
804 u64 data)) 807 unsigned long data))
805{ 808{
806 int i, j; 809 int i, j;
807 int retval = 0; 810 int retval = 0;
@@ -846,10 +849,11 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
846 849
847void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte) 850void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
848{ 851{
849 kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp); 852 kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp);
850} 853}
851 854
852static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data) 855static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp,
856 unsigned long data)
853{ 857{
854 u64 *spte; 858 u64 *spte;
855 int young = 0; 859 int young = 0;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b7c78a403dc2..7495ce347344 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2717,8 +2717,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
2717 int r; 2717 int r;
2718 int cpu; 2718 int cpu;
2719 2719
2720 kvm_init_debug();
2721
2722 r = kvm_arch_init(opaque); 2720 r = kvm_arch_init(opaque);
2723 if (r) 2721 if (r)
2724 goto out_fail; 2722 goto out_fail;
@@ -2785,6 +2783,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
2785 kvm_preempt_ops.sched_in = kvm_sched_in; 2783 kvm_preempt_ops.sched_in = kvm_sched_in;
2786 kvm_preempt_ops.sched_out = kvm_sched_out; 2784 kvm_preempt_ops.sched_out = kvm_sched_out;
2787 2785
2786 kvm_init_debug();
2787
2788 return 0; 2788 return 0;
2789 2789
2790out_free: 2790out_free:
@@ -2807,7 +2807,6 @@ out_free_0:
2807out: 2807out:
2808 kvm_arch_exit(); 2808 kvm_arch_exit();
2809out_fail: 2809out_fail:
2810 kvm_exit_debug();
2811 return r; 2810 return r;
2812} 2811}
2813EXPORT_SYMBOL_GPL(kvm_init); 2812EXPORT_SYMBOL_GPL(kvm_init);
@@ -2815,6 +2814,7 @@ EXPORT_SYMBOL_GPL(kvm_init);
2815void kvm_exit(void) 2814void kvm_exit(void)
2816{ 2815{
2817 tracepoint_synchronize_unregister(); 2816 tracepoint_synchronize_unregister();
2817 kvm_exit_debug();
2818 misc_deregister(&kvm_dev); 2818 misc_deregister(&kvm_dev);
2819 kmem_cache_destroy(kvm_vcpu_cache); 2819 kmem_cache_destroy(kvm_vcpu_cache);
2820 sysdev_unregister(&kvm_sysdev); 2820 sysdev_unregister(&kvm_sysdev);
@@ -2824,7 +2824,6 @@ void kvm_exit(void)
2824 on_each_cpu(hardware_disable, NULL, 1); 2824 on_each_cpu(hardware_disable, NULL, 1);
2825 kvm_arch_hardware_unsetup(); 2825 kvm_arch_hardware_unsetup();
2826 kvm_arch_exit(); 2826 kvm_arch_exit();
2827 kvm_exit_debug();
2828 free_cpumask_var(cpus_hardware_enabled); 2827 free_cpumask_var(cpus_hardware_enabled);
2829 __free_page(bad_page); 2828 __free_page(bad_page);
2830} 2829}