Skip to content

Commit

Permalink
KVM: PPC: BookE: Add support for vcpu->mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Graf committed Oct 5, 2012
1 parent 4ffc635 commit d69c643
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/powerpc/kvm/booke.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
continue;
}

if (vcpu->mode == EXITING_GUEST_MODE) {
r = 1;
break;
}

/* Going into guest context! Yay! */
vcpu->mode = IN_GUEST_MODE;
smp_wmb();

break;
}

Expand Down Expand Up @@ -572,6 +581,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
kvm_guest_exit();

out:
vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb();
local_irq_enable();
return ret;
}
Expand Down

0 comments on commit d69c643

Please sign in to comment.