aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-08-08 14:31:13 -0400
committerAlexander Graf <agraf@suse.de>2012-10-05 17:38:41 -0400
commit4ffc6356ec690f77f65b7b78e0047a3fe8316371 (patch)
treebcec56a93d956094d9efd6c28b44c6125938b150 /arch/powerpc/kvm/booke.c
parent8043e494da644ec174f7df0b67f88ccf8777a1ce (diff)
KVM: PPC: BookE: Add check_requests helper function
We need a central place to check for pending requests in. Add one that only does the timer check we already do in a different place. Later, this central function can be extended by more checks. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 1d4ce9a80f55..bcf87fe89179 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -419,13 +419,6 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
419 unsigned long *pending = &vcpu->arch.pending_exceptions; 419 unsigned long *pending = &vcpu->arch.pending_exceptions;
420 unsigned int priority; 420 unsigned int priority;
421 421
422 if (vcpu->requests) {
423 if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
424 smp_mb();
425 update_timer_ints(vcpu);
426 }
427 }
428
429 priority = __ffs(*pending); 422 priority = __ffs(*pending);
430 while (priority < BOOKE_IRQPRIO_MAX) { 423 while (priority < BOOKE_IRQPRIO_MAX) {
431 if (kvmppc_booke_irqprio_deliver(vcpu, priority)) 424 if (kvmppc_booke_irqprio_deliver(vcpu, priority))
@@ -461,6 +454,14 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
461 return r; 454 return r;
462} 455}
463 456
457static void kvmppc_check_requests(struct kvm_vcpu *vcpu)
458{
459 if (vcpu->requests) {
460 if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu))
461 update_timer_ints(vcpu);
462 }
463}
464
464/* 465/*
465 * Common checks before entering the guest world. Call with interrupts 466 * Common checks before entering the guest world. Call with interrupts
466 * disabled. 467 * disabled.
@@ -485,6 +486,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
485 break; 486 break;
486 } 487 }
487 488
489 smp_mb();
490 if (vcpu->requests) {
491 /* Make sure we process requests preemptable */
492 local_irq_enable();
493 kvmppc_check_requests(vcpu);
494 local_irq_disable();
495 continue;
496 }
497
488 if (kvmppc_core_prepare_to_enter(vcpu)) { 498 if (kvmppc_core_prepare_to_enter(vcpu)) {
489 /* interrupts got enabled in between, so we 499 /* interrupts got enabled in between, so we
490 are back at square 1 */ 500 are back at square 1 */