summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-08-10 12:28:50 +0200
committerAlexander Graf <agraf@suse.de>2012-10-05 23:38:42 +0200
commit03d25c5bd5c3125055bd36f4813ddb817def19dd (patch)
treeed1135f8862466b9fc9373049f30ce087fb668a8 /arch/powerpc/kvm/booke.c
parent2d8185d4ee22f425001d28d1817fc8d478e6fa02 (diff)
downloadop-kernel-dev-03d25c5bd5c3125055bd36f4813ddb817def19dd.zip
op-kernel-dev-03d25c5bd5c3125055bd36f4813ddb817def19dd.tar.gz
KVM: PPC: Use same kvmppc_prepare_to_enter code for booke and book3s_pr
We need to do the same things when preparing to enter a guest for booke and book3s_pr cores. Fold the generic code into a generic function that both call. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c58
1 files changed, 1 insertions, 57 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 683cbd6..4652e0b 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -455,10 +455,8 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
return r;
}
-static void kvmppc_check_requests(struct kvm_vcpu *vcpu)
+void kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
{
- trace_kvm_check_requests(vcpu);
-
if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu))
update_timer_ints(vcpu);
#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
@@ -467,60 +465,6 @@ static void kvmppc_check_requests(struct kvm_vcpu *vcpu)
#endif
}
-/*
- * Common checks before entering the guest world. Call with interrupts
- * disabled.
- *
- * returns !0 if a signal is pending and check_signal is true
- */
-static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
-{
- int r = 0;
-
- WARN_ON_ONCE(!irqs_disabled());
- while (true) {
- if (need_resched()) {
- local_irq_enable();
- cond_resched();
- local_irq_disable();
- continue;
- }
-
- if (signal_pending(current)) {
- r = 1;
- break;
- }
-
- smp_mb();
- if (vcpu->requests) {
- /* Make sure we process requests preemptable */
- local_irq_enable();
- kvmppc_check_requests(vcpu);
- local_irq_disable();
- continue;
- }
-
- if (kvmppc_core_prepare_to_enter(vcpu)) {
- /* interrupts got enabled in between, so we
- are back at square 1 */
- continue;
- }
-
- if (vcpu->mode == EXITING_GUEST_MODE) {
- r = 1;
- break;
- }
-
- /* Going into guest context! Yay! */
- vcpu->mode = IN_GUEST_MODE;
- smp_wmb();
-
- break;
- }
-
- return r;
-}
-
int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
{
int ret;
OpenPOWER on IntegriCloud