aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-08-12 06:42:30 -0400
committerAlexander Graf <agraf@suse.de>2012-10-05 17:38:45 -0400
commit24afa37b9c8f035d2fe2028e4824bc4e49bafe73 (patch)
treeb295955b1b74bcdd404f8bb29d5a21d6ae708419 /arch/powerpc/kvm/booke.c
parent0652eaaebea0995b3236e51dec727d62264f4248 (diff)
KVM: PPC: Consistentify vcpu exit path
When getting out of __vcpu_run, let's be consistent about the state we return in. We want to always * have IRQs enabled * have called kvm_guest_exit before Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 887c7cc02146..aae535f6d9de 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -481,6 +481,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
481 481
482 local_irq_disable(); 482 local_irq_disable();
483 if (kvmppc_prepare_to_enter(vcpu)) { 483 if (kvmppc_prepare_to_enter(vcpu)) {
484 local_irq_enable();
484 kvm_run->exit_reason = KVM_EXIT_INTR; 485 kvm_run->exit_reason = KVM_EXIT_INTR;
485 ret = -EINTR; 486 ret = -EINTR;
486 goto out; 487 goto out;
@@ -512,6 +513,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
512 513
513 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 514 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
514 515
516 /* No need for kvm_guest_exit. It's done in handle_exit.
517 We also get here with interrupts enabled. */
518
515#ifdef CONFIG_PPC_FPU 519#ifdef CONFIG_PPC_FPU
516 kvmppc_save_guest_fp(vcpu); 520 kvmppc_save_guest_fp(vcpu);
517 521
@@ -527,12 +531,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
527 current->thread.fpexc_mode = fpexc_mode; 531 current->thread.fpexc_mode = fpexc_mode;
528#endif 532#endif
529 533
530 kvm_guest_exit();
531
532out: 534out:
533 vcpu->mode = OUTSIDE_GUEST_MODE; 535 vcpu->mode = OUTSIDE_GUEST_MODE;
534 smp_wmb(); 536 smp_wmb();
535 local_irq_enable();
536 return ret; 537 return ret;
537} 538}
538 539
@@ -947,14 +948,16 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
947 if (!(r & RESUME_HOST)) { 948 if (!(r & RESUME_HOST)) {
948 local_irq_disable(); 949 local_irq_disable();
949 if (kvmppc_prepare_to_enter(vcpu)) { 950 if (kvmppc_prepare_to_enter(vcpu)) {
951 local_irq_enable();
950 run->exit_reason = KVM_EXIT_INTR; 952 run->exit_reason = KVM_EXIT_INTR;
951 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); 953 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
952 kvmppc_account_exit(vcpu, SIGNAL_EXITS); 954 kvmppc_account_exit(vcpu, SIGNAL_EXITS);
955 } else {
956 /* Going back to guest */
957 kvm_guest_enter();
953 } 958 }
954 } 959 }
955 960
956 kvm_guest_enter();
957
958 return r; 961 return r;
959} 962}
960 963