aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-02-28 06:00:41 -0500
committerAvi Kivity <avi@redhat.com>2012-04-08 05:55:29 -0400
commit03660ba27020250eae0b5a2722e0c7bec4968c3c (patch)
treec774ab4a1154ee04374b31edcee9883a926defea /arch/powerpc/kvm/booke.c
parent7cc1e8ee78f469ecff8aa29465325f1e4c5e1b5f (diff)
KVM: PPC: Booke: only prepare to enter when we enter
So far, we've always called prepare_to_enter even when all we did was return to the host. This patch changes that semantic to only call prepare_to_enter when we actually want to get back into the guest. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 8e8aa4cb5968..9f27258d8035 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -464,7 +464,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
464 * 464 *
465 * returns !0 if a signal is pending and check_signal is true 465 * returns !0 if a signal is pending and check_signal is true
466 */ 466 */
467static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal) 467static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
468{ 468{
469 int r = 0; 469 int r = 0;
470 470
@@ -477,7 +477,7 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal)
477 continue; 477 continue;
478 } 478 }
479 479
480 if (check_signal && signal_pending(current)) { 480 if (signal_pending(current)) {
481 r = 1; 481 r = 1;
482 break; 482 break;
483 } 483 }
@@ -509,7 +509,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
509 } 509 }
510 510
511 local_irq_disable(); 511 local_irq_disable();
512 if (kvmppc_prepare_to_enter(vcpu, true)) { 512 if (kvmppc_prepare_to_enter(vcpu)) {
513 kvm_run->exit_reason = KVM_EXIT_INTR; 513 kvm_run->exit_reason = KVM_EXIT_INTR;
514 ret = -EINTR; 514 ret = -EINTR;
515 goto out; 515 goto out;
@@ -946,11 +946,13 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
946 * To avoid clobbering exit_reason, only check for signals if we 946 * To avoid clobbering exit_reason, only check for signals if we
947 * aren't already exiting to userspace for some other reason. 947 * aren't already exiting to userspace for some other reason.
948 */ 948 */
949 local_irq_disable(); 949 if (!(r & RESUME_HOST)) {
950 if (kvmppc_prepare_to_enter(vcpu, !(r & RESUME_HOST))) { 950 local_irq_disable();
951 run->exit_reason = KVM_EXIT_INTR; 951 if (kvmppc_prepare_to_enter(vcpu)) {
952 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); 952 run->exit_reason = KVM_EXIT_INTR;
953 kvmppc_account_exit(vcpu, SIGNAL_EXITS); 953 r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
954 kvmppc_account_exit(vcpu, SIGNAL_EXITS);
955 }
954 } 956 }
955 957
956 return r; 958 return r;