From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt@linux.vnet.ibm.com Date: Wed, 23 Jul 2008 08:36:44 +0000 Subject: [PATCH 3/6] kvmppc: add hypercall infrastructure - guest part Message-Id: <1216802207-32675-4-git-send-email-ehrhardt@linux.vnet.ibm.com> List-Id: References: <1216802207-32675-1-git-send-email-ehrhardt@linux.vnet.ibm.com> In-Reply-To: <1216802207-32675-1-git-send-email-ehrhardt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org, embedded-hypervisor@power.org, linuxppc-dev@ozlabs.org Cc: hollisb@us.ibm.com From: Christian Ehrhardt This adds the guest portion of the hypercall infrastructure, basically an illegal instruction with a defined layout. See http://kvm.qumranet.com/kvmwiki/PowerPC_Hypercall_ABI for more detail on the hypercall ABI for powerpc. Signed-off-by: Christian Ehrhardt --- [diffstat] kvm_para.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) [diff] 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 @@ -25,6 +25,8 @@ #ifdef __KERNEL__ #include + +#define KVM_HYPERCALL_BIN 0x03ffffff static struct kvmppc_para_features { char *dtcell; @@ -63,6 +65,20 @@ void kvm_guest_init(void); +static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) +{ + register unsigned long hcall asm ("r0") = nr; + register unsigned long arg1 asm ("r3") = p1; + register long ret asm ("r11"); + + asm volatile(".long %1" + : "=r"(ret) + : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg1) + : "r4", "r5", "r6", "r7", "r8", + "r9", "r10", "r12", "cc"); + return ret; +} + #endif /* __KERNEL__ */ #endif /* __POWERPC_KVM_PARA_H__ */