Commit d69c6436 authored by Alexander Graf's avatar Alexander Graf

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: default avatarAlexander Graf <agraf@suse.de>
parent 4ffc6356
...@@ -501,6 +501,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu) ...@@ -501,6 +501,15 @@ static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
continue; continue;
} }
if (vcpu->mode == EXITING_GUEST_MODE) {
r = 1;
break;
}
/* Going into guest context! Yay! */
vcpu->mode = IN_GUEST_MODE;
smp_wmb();
break; break;
} }
...@@ -572,6 +581,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) ...@@ -572,6 +581,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
kvm_guest_exit(); kvm_guest_exit();
out: out:
vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb();
local_irq_enable(); local_irq_enable();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment