aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-06-15 09:18:26 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2016-07-01 05:03:21 -0400
commit6edaa5307f3f51e4e56dc4c63f68a69d88c6ddf5 (patch)
tree8466e2bf1da7bdce8bcbe1d728003422e6faa6da
parentebaac1736245e78109cd47d453a86a18dcfc94b8 (diff)
KVM: remove kvm_guest_enter/exit wrappers
Use the functions from context_tracking.h directly. Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Rik van Riel <riel@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/arm/kvm/arm.c8
-rw-r--r--arch/mips/kvm/mips.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c4
-rw-r--r--arch/powerpc/kvm/book3s_pr.c4
-rw-r--r--arch/powerpc/kvm/booke.c4
-rw-r--r--arch/powerpc/kvm/powerpc.c2
-rw-r--r--arch/s390/kvm/kvm-s390.c4
-rw-r--r--arch/s390/kvm/vsie.c4
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--include/linux/kvm_host.h22
10 files changed, 19 insertions, 41 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index f20ca84537f5..9ac4970882fe 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -615,7 +615,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
615 * Enter the guest 615 * Enter the guest
616 */ 616 */
617 trace_kvm_entry(*vcpu_pc(vcpu)); 617 trace_kvm_entry(*vcpu_pc(vcpu));
618 __kvm_guest_enter(); 618 guest_enter_irqoff();
619 vcpu->mode = IN_GUEST_MODE; 619 vcpu->mode = IN_GUEST_MODE;
620 620
621 ret = kvm_call_hyp(__kvm_vcpu_run, vcpu); 621 ret = kvm_call_hyp(__kvm_vcpu_run, vcpu);
@@ -641,14 +641,14 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
641 local_irq_enable(); 641 local_irq_enable();
642 642
643 /* 643 /*
644 * We do local_irq_enable() before calling kvm_guest_exit() so 644 * We do local_irq_enable() before calling guest_exit() so
645 * that if a timer interrupt hits while running the guest we 645 * that if a timer interrupt hits while running the guest we
646 * account that tick as being spent in the guest. We enable 646 * account that tick as being spent in the guest. We enable
647 * preemption after calling kvm_guest_exit() so that if we get 647 * preemption after calling guest_exit() so that if we get
648 * preempted we make sure ticks after that is not counted as 648 * preempted we make sure ticks after that is not counted as
649 * guest time. 649 * guest time.
650 */ 650 */
651 kvm_guest_exit(); 651 guest_exit();
652 trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu)); 652 trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
653 653
654 /* 654 /*
diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c
index 5a2b9034a05c..5f1163653b50 100644
--- a/arch/mips/kvm/mips.c
+++ b/arch/mips/kvm/mips.c
@@ -406,7 +406,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
406 kvm_mips_deliver_interrupts(vcpu, 406 kvm_mips_deliver_interrupts(vcpu,
407 kvm_read_c0_guest_cause(vcpu->arch.cop0)); 407 kvm_read_c0_guest_cause(vcpu->arch.cop0));
408 408
409 __kvm_guest_enter(); 409 guest_enter_irqoff();
410 410
411 /* Disable hardware page table walking while in guest */ 411 /* Disable hardware page table walking while in guest */
412 htw_stop(); 412 htw_stop();
@@ -418,7 +418,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
418 /* Re-enable HTW before enabling interrupts */ 418 /* Re-enable HTW before enabling interrupts */
419 htw_start(); 419 htw_start();
420 420
421 __kvm_guest_exit(); 421 guest_exit_irqoff();
422 local_irq_enable(); 422 local_irq_enable();
423 423
424 if (vcpu->sigset_active) 424 if (vcpu->sigset_active)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index e20beae5ca7a..6b2859c12ae8 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -2522,7 +2522,7 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
2522 list_for_each_entry(pvc, &core_info.vcs[sub], preempt_list) 2522 list_for_each_entry(pvc, &core_info.vcs[sub], preempt_list)
2523 spin_unlock(&pvc->lock); 2523 spin_unlock(&pvc->lock);
2524 2524
2525 kvm_guest_enter(); 2525 guest_enter();
2526 2526
2527 srcu_idx = srcu_read_lock(&vc->kvm->srcu); 2527 srcu_idx = srcu_read_lock(&vc->kvm->srcu);
2528 2528
@@ -2570,7 +2570,7 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)
2570 2570
2571 /* make sure updates to secondary vcpu structs are visible now */ 2571 /* make sure updates to secondary vcpu structs are visible now */
2572 smp_mb(); 2572 smp_mb();
2573 kvm_guest_exit(); 2573 guest_exit();
2574 2574
2575 for (sub = 0; sub < core_info.n_subcores; ++sub) 2575 for (sub = 0; sub < core_info.n_subcores; ++sub)
2576 list_for_each_entry_safe(pvc, vcnext, &core_info.vcs[sub], 2576 list_for_each_entry_safe(pvc, vcnext, &core_info.vcs[sub],
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 8e4f64f0b774..6a66c5ff0827 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -914,7 +914,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
914 /* We get here with MSR.EE=1 */ 914 /* We get here with MSR.EE=1 */
915 915
916 trace_kvm_exit(exit_nr, vcpu); 916 trace_kvm_exit(exit_nr, vcpu);
917 kvm_guest_exit(); 917 guest_exit();
918 918
919 switch (exit_nr) { 919 switch (exit_nr) {
920 case BOOK3S_INTERRUPT_INST_STORAGE: 920 case BOOK3S_INTERRUPT_INST_STORAGE:
@@ -1531,7 +1531,7 @@ static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1531 1531
1532 kvmppc_clear_debug(vcpu); 1532 kvmppc_clear_debug(vcpu);
1533 1533
1534 /* No need for kvm_guest_exit. It's done in handle_exit. 1534 /* No need for guest_exit. It's done in handle_exit.
1535 We also get here with interrupts enabled. */ 1535 We also get here with interrupts enabled. */
1536 1536
1537 /* Make sure we save the guest FPU/Altivec/VSX state */ 1537 /* Make sure we save the guest FPU/Altivec/VSX state */
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 4afae695899a..02b4672f7347 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -776,7 +776,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
776 776
777 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 777 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
778 778
779 /* No need for kvm_guest_exit. It's done in handle_exit. 779 /* No need for guest_exit. It's done in handle_exit.
780 We also get here with interrupts enabled. */ 780 We also get here with interrupts enabled. */
781 781
782 /* Switch back to user space debug context */ 782 /* Switch back to user space debug context */
@@ -1012,7 +1012,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1012 } 1012 }
1013 1013
1014 trace_kvm_exit(exit_nr, vcpu); 1014 trace_kvm_exit(exit_nr, vcpu);
1015 __kvm_guest_exit(); 1015 guest_exit_irqoff();
1016 1016
1017 local_irq_enable(); 1017 local_irq_enable();
1018 1018
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 02416fea7653..1ac036e45ed4 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -119,7 +119,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
119 continue; 119 continue;
120 } 120 }
121 121
122 __kvm_guest_enter(); 122 guest_enter_irqoff();
123 return 1; 123 return 1;
124 } 124 }
125 125
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 03eeeb0ded24..d42428c11794 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2623,14 +2623,14 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
2623 * guest_enter and guest_exit should be no uaccess. 2623 * guest_enter and guest_exit should be no uaccess.
2624 */ 2624 */
2625 local_irq_disable(); 2625 local_irq_disable();
2626 __kvm_guest_enter(); 2626 guest_enter_irqoff();
2627 __disable_cpu_timer_accounting(vcpu); 2627 __disable_cpu_timer_accounting(vcpu);
2628 local_irq_enable(); 2628 local_irq_enable();
2629 exit_reason = sie64a(vcpu->arch.sie_block, 2629 exit_reason = sie64a(vcpu->arch.sie_block,
2630 vcpu->run->s.regs.gprs); 2630 vcpu->run->s.regs.gprs);
2631 local_irq_disable(); 2631 local_irq_disable();
2632 __enable_cpu_timer_accounting(vcpu); 2632 __enable_cpu_timer_accounting(vcpu);
2633 __kvm_guest_exit(); 2633 guest_exit_irqoff();
2634 local_irq_enable(); 2634 local_irq_enable();
2635 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); 2635 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
2636 2636
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 6895e7b3be12..c106488b4137 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -765,13 +765,13 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
765 765
766 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); 766 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
767 local_irq_disable(); 767 local_irq_disable();
768 kvm_guest_enter(); 768 guest_enter_irqoff();
769 local_irq_enable(); 769 local_irq_enable();
770 770
771 rc = sie64a(scb_s, vcpu->run->s.regs.gprs); 771 rc = sie64a(scb_s, vcpu->run->s.regs.gprs);
772 772
773 local_irq_disable(); 773 local_irq_disable();
774 kvm_guest_exit(); 774 guest_exit_irqoff();
775 local_irq_enable(); 775 local_irq_enable();
776 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); 776 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
777 777
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9e50e2ad6d08..618463abeec5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6658,7 +6658,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6658 6658
6659 trace_kvm_entry(vcpu->vcpu_id); 6659 trace_kvm_entry(vcpu->vcpu_id);
6660 wait_lapic_expire(vcpu); 6660 wait_lapic_expire(vcpu);
6661 __kvm_guest_enter(); 6661 guest_enter_irqoff();
6662 6662
6663 if (unlikely(vcpu->arch.switch_db_regs)) { 6663 if (unlikely(vcpu->arch.switch_db_regs)) {
6664 set_debugreg(0, 7); 6664 set_debugreg(0, 7);
@@ -6717,7 +6717,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
6717 */ 6717 */
6718 barrier(); 6718 barrier();
6719 6719
6720 kvm_guest_exit(); 6720 guest_exit();
6721 6721
6722 preempt_enable(); 6722 preempt_enable();
6723 6723
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ffff40522688..66b2f6159aad 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -875,28 +875,6 @@ static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
875} 875}
876#endif 876#endif
877 877
878/* must be called with irqs disabled */
879static inline void __kvm_guest_enter(void)
880{
881 guest_enter_irqoff();
882}
883
884/* must be called with irqs disabled */
885static inline void __kvm_guest_exit(void)
886{
887 guest_exit_irqoff();
888}
889
890static inline void kvm_guest_enter(void)
891{
892 guest_enter();
893}
894
895static inline void kvm_guest_exit(void)
896{
897 guest_exit();
898}
899
900/* 878/*
901 * search_memslots() and __gfn_to_memslot() are here because they are 879 * search_memslots() and __gfn_to_memslot() are here because they are
902 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c. 880 * used in non-modular code in arch/powerpc/kvm/book3s_hv_rm_mmu.c.