From: ehrhardt@linux.vnet.ibm.com
To: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org
Cc: hollisb@us.ibm.com
Subject: [PATCH 2/3] kvmppc: add hypercall infrastructure - guest part v3
Date: Tue, 16 Sep 2008 08:27:29 +0200 [thread overview]
Message-ID: <1221546450-15761-3-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)
In-Reply-To: <1221546450-15761-1-git-send-email-ehrhardt@linux.vnet.ibm.com>
From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
This adds the guest portion of the hypercall infrastructure.
Version 3 now follows the beat ABI, but proposes a new implementation style as
static inline asm functions instead of pure assembler code. That should allow
the compiler to be more flexible and therefore a better optimization.
If people agree on that new implementation style we might merge this code.
The current implementation of beat style hypercalls can be found in
arch/powerpc/platforms/cell/beat_hvCall.S
Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---
[diffstat]
epapr_hcalls.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
[diff]
diff --git a/include/asm-powerpc/epapr_hcalls.h b/include/asm-powerpc/epapr_hcalls.h
new file mode 100644
--- /dev/null
+++ b/include/asm-powerpc/epapr_hcalls.h
@@ -0,0 +1,59 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2008
+ *
+ * Authors:
+ * Christian Ehrhardt <ehrhardt@de.ibm.com>
+ */
+
+#ifndef __POWERPC_EPAPR_HCALLS_H__
+#define __POWERPC_EPAPR_HCALLS_H__
+
+#ifdef __KERNEL__
+
+/* Hypercalls use the beat ABI */
+#define KVM_HYPERCALL_BIN 0x44000022
+
+static inline long epapr_hypercall_1in_1out(unsigned int nr, unsigned long p1)
+{
+ register unsigned long hcall asm ("r11") = nr;
+ register unsigned long arg1_ret asm ("r3") = p1;
+
+ asm volatile(".long %1"
+ : "+r"(arg1_ret)
+ : "i"(KVM_HYPERCALL_BIN), "r"(hcall)
+ : "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r12", "cc");
+ return arg1_ret;
+}
+
+static inline long epapr_hypercall_2in_1out(unsigned int nr,
+ unsigned long p1, unsigned long p2)
+{
+ register unsigned long hcall asm ("r11") = nr;
+ register unsigned long arg1_ret asm ("r3") = p1;
+ register unsigned long arg2 asm ("r4") = p2;
+
+ asm volatile(".long %1"
+ : "+r"(arg1_ret)
+ : "i"(KVM_HYPERCALL_BIN), "r"(hcall), "r"(arg2)
+ : "r5", "r6", "r7", "r8",
+ "r9", "r10", "r12", "cc");
+ return arg1_ret;
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* __POWERPC_EPAPR_HCALLS_H__ */
next prev parent reply other threads:[~2008-09-16 6:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-16 6:27 [PATCH 0/3][RFC] kvmppc: paravirtualization interface - guest part v3 ehrhardt
2008-09-16 6:27 ` [PATCH 1/3] kvmppc: read device tree hypervisor node infrastructure ehrhardt
2008-09-16 6:27 ` ehrhardt [this message]
2008-10-13 16:42 ` [PATCH 2/3] kvmppc: add hypercall infrastructure - guest part v3 Kumar Gala
2008-10-13 17:29 ` Hollis Blanchard
2008-10-13 17:44 ` Kumar Gala
2008-09-16 6:27 ` [PATCH 3/3] kvmppc: magic page paravirtualization - guest part ehrhardt
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=1221546450-15761-3-git-send-email-ehrhardt@linux.vnet.ibm.com \
--to=ehrhardt@linux.vnet.ibm.com \
--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).