aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-08-08 14:44:20 -0400
committerAlexander Graf <agraf@suse.de>2012-10-05 17:38:41 -0400
commitd69c6436443c05a64452054f51a79316297755f4 (patch)
tree34e6464340857f8452944e35d441afad11958ac9 /arch/powerpc/kvm/booke.c
parent4ffc6356ec690f77f65b7b78e0047a3fe8316371 (diff)
KVM: PPC: BookE: Add support for vcpu->mode
Generic KVM code might want to know whether we are inside guest context or outside. It also wants to be able to push us out of guest context. Add support to the BookE code for the generic vcpu->mode field that describes the above states. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.c')
-rw-r--r--arch/powerpc/kvm/booke.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index bcf87fe89179..70a86c0a9d85 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -501,6 +501,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
501 continue; 501 continue;
502 } 502 }
503 503
504 if (vcpu->mode == EXITING_GUEST_MODE) {
505 r = 1;
506 break;
507 }
508
509 /* Going into guest context! Yay! */
510 vcpu->mode = IN_GUEST_MODE;
511 smp_wmb();
512
504 break; 513 break;
505 } 514 }
506 515
@@ -572,6 +581,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
572 kvm_guest_exit(); 581 kvm_guest_exit();
573 582
574out: 583out:
584 vcpu->mode = OUTSIDE_GUEST_MODE;
585 smp_wmb();
575 local_irq_enable(); 586 local_irq_enable();
576 return ret; 587 return ret;
577} 588}