From: ehrhardt@linux.vnet.ibm.com
To: kvm-ppc@vger.kernel.org, embedded-hypervisor@power.org,
linuxppc-dev@ozlabs.org
Cc: hollisb@us.ibm.com
Subject: [PATCH 2/6] kvmppc: add hypercall infrastructure - host part
Date: Wed, 23 Jul 2008 10:36:43 +0200 [thread overview]
Message-ID: <1216802207-32675-3-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1216802207-32675-1-git-send-email-ehrhardt@linux.vnet.ibm.com>
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
This adds the host portion of the hypercall infrastructure which receives
the guest calls - no specific hcall function is implemented in this patch.
Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---
[diffstat]
arch/powerpc/kvm/emulate.c | 27 +++++++++++++++++++++++++++
include/asm-powerpc/kvm_para.h | 2 ++
2 files changed, 29 insertions(+)
[diff]
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -203,6 +203,24 @@
kvmppc_set_msr(vcpu, vcpu->arch.srr1);
}
+static int kvmppc_do_hypercall(struct kvm_vcpu *vcpu)
+{
+ int ret = 0;
+
+ switch (vcpu->arch.gpr[0]) {
+ default:
+ printk(KERN_ERR"unknown hypercall %d\n", vcpu->arch.gpr[0]);
+ kvmppc_dump_vcpu(vcpu);
+ ret = -ENOSYS;
+ }
+
+ vcpu->arch.gpr[11] = ret;
+ vcpu->arch.pc += 4; /* Advance past hypercall instruction. */
+
+ return ret;
+}
+
+
/* XXX to do:
* lhax
* lhaux
@@ -232,6 +250,15 @@
int advance = 1;
switch (get_op(inst)) {
+ case 0:
+ if (inst == KVM_HYPERCALL_BIN) {
+ kvmppc_do_hypercall(vcpu);
+ advance = 0; /* kvmppc_do_hypercall handles the PC. */
+ } else {
+ printk(KERN_ERR"unknown op %d\n", get_op(inst));
+ emulated = EMULATE_FAIL;
+ }
+ break;
case 3: /* trap */
printk("trap!\n");
kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_PROGRAM);
diff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h
--- a/include/asm-powerpc/kvm_para.h
+++ b/include/asm-powerpc/kvm_para.h
@@ -22,6 +22,8 @@
#ifdef __KERNEL__
+#define KVM_HYPERCALL_BIN 0x03ffffff
+
static inline int kvm_para_available(void)
{
return 0;
next prev parent reply other threads:[~2008-07-23 8:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 8:36 [PATCH 0/6][RFC] kvmppc: paravirtualization interface ehrhardt
2008-07-23 8:36 ` [PATCH 1/6] kvmppc: read device tree hypervisor node infrastructure ehrhardt
2008-07-24 1:41 ` Tony Breeds
2008-07-24 7:44 ` Christian Ehrhardt
2008-07-23 8:36 ` ehrhardt [this message]
2008-07-24 1:43 ` [PATCH 2/6] kvmppc: add hypercall infrastructure - host part Tony Breeds
2008-07-30 13:41 ` Geert Uytterhoeven
2008-07-23 8:36 ` [PATCH 3/6] kvmppc: add hypercall infrastructure - guest part ehrhardt
2008-07-24 1:45 ` Tony Breeds
2008-07-24 7:56 ` Christian Ehrhardt
2008-07-23 8:36 ` [PATCH 4/6] kvmppc: magic page hypercall - host part ehrhardt
2008-07-24 1:49 ` Tony Breeds
2008-07-23 8:36 ` [PATCH 5/6] kvmppc: magic page paravirtualization - guest part ehrhardt
2008-07-24 1:59 ` Tony Breeds
2008-07-23 8:36 ` [PATCH 6/6] kvmppc: kvm-userspace: device tree modification for magicpage ehrhardt
2008-07-24 2:01 ` [PATCH 0/6][RFC] kvmppc: paravirtualization interface Tony Breeds
2008-07-24 8:17 ` Christian Ehrhardt
2008-07-25 1:08 ` Tony Breeds
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=1216802207-32675-3-git-send-email-ehrhardt@linux.vnet.ibm.com \
--to=ehrhardt@linux.vnet.ibm.com \
--cc=embedded-hypervisor@power.org \
--cc=hollisb@us.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
/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).