From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: KVM list <kvm@vger.kernel.org>, kvmarm@lists.cs.columbia.edu
Subject: [PATCH 2/5] KVM: PPC: BookE: Add support for vcpu->mode
Date: Fri, 10 Aug 2012 00:13:12 +0200 [thread overview]
Message-ID: <1344550395-2278-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1344550395-2278-1-git-send-email-agraf@suse.de>
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>
---
arch/powerpc/kvm/booke.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index bcf87fe..70a86c0 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)
continue;
}
+ if (vcpu->mode == EXITING_GUEST_MODE) {
+ r = 1;
+ break;
+ }
+
+ /* Going into guest context! Yay! */
+ vcpu->mode = IN_GUEST_MODE;
+ smp_wmb();
+
break;
}
@@ -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;
}
--
1.6.0.2
next prev parent reply other threads:[~2012-08-09 22:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-09 22:13 [PATCH 0/5] KVM: PPC: E500: Implement MMU Notifiers Alexander Graf
2012-08-09 22:13 ` [PATCH 1/5] KVM: PPC: BookE: Add check_requests helper function Alexander Graf
2012-08-09 22:13 ` Alexander Graf [this message]
2012-08-09 22:13 ` [PATCH 3/5] KVM: PPC: E500: Implement MMU notifiers Alexander Graf
2012-08-09 22:13 ` [PATCH 4/5] KVM: PPC: Add cache flush on page map Alexander Graf
2012-08-09 22:13 ` [PATCH 5/5] KVM: PPC: BookE: Add some more trace points Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344550395-2278-3-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).