From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
Stefano.Stabellini@eu.citrix.com, will.deacon@arm.com,
catalin.marinas@arm.com, Ian.Campbell@citrix.com,
konrad.wilk@oracle.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v4 5/6] arm64/xen: introduce CONFIG_XEN on ARM64
Date: Wed, 5 Jun 2013 18:02:06 +0100 [thread overview]
Message-ID: <1370451727-26826-5-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1306051605030.4589@kaball.uk.xensource.com>
Introduce CONFIG_XEN on ARM64, compile arch/arm/xen under arch/arm64.
Add the ARMv8 specific hypercall wrappers to arch/arm/xen/hypercall.S.
Align few lines in hypercall.S since we are at it.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Changes in v2:
- remove depends on !GENERIC_ATOMIC64;
- compile enlighten.c and grant_table.c from arch/arm directly;
- fix the privcmd implementation: according to the aarch64 procedure
call ABI the first 7 parameters are passed on registers so we don't need
to push/pop anything.
Changes in v3:
- update comment to reflect the actual hypercall calling convention.
Changes in v4:
- build the entire arch/arm/xen directory under arch/arm64, ifdef
hypercall.S appropriately.
---
arch/arm/xen/hypercall.S | 98 ++++++++++++++++++++++++++++++----------------
arch/arm64/Kconfig | 10 +++++
arch/arm64/Makefile | 1 +
3 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
index 199cb2d..114b356 100644
--- a/arch/arm/xen/hypercall.S
+++ b/arch/arm/xen/hypercall.S
@@ -31,51 +31,93 @@
*/
/*
- * The Xen hypercall calling convention is very similar to the ARM
- * procedure calling convention: the first paramter is passed in r0, the
- * second in r1, the third in r2 and the fourth in r3. Considering that
- * Xen hypercalls have 5 arguments at most, the fifth paramter is passed
- * in r4, differently from the procedure calling convention of using the
- * stack for that case.
+ * The Xen hypercall calling convention is very similar to the ARM/ARM64
+ * procedure calling convention: the first paramter is passed in r0/x0,
+ * the second in r1/x1, the third in r2/x2 and the fourth in r3/x3.
+ * Considering that Xen hypercalls have 5 arguments at most, the fifth
+ * paramter is always passed in r4/x4, differently from the ARM
+ * procedure calling convention of using the stack for that case.
*
- * The hypercall number is passed in r12.
+ * The hypercall number is passed in r12/x16.
*
- * The return value is in r0.
+ * The return value is in r0/x0.
*
- * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
- * hypercall tag.
+ * The hvc ISS is required to be 0xEA1, that is the Xen specific
+ * ARM/ARM64 hypercall tag.
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
-#include <asm/opcodes-virt.h>
#include <xen/interface/xen.h>
#define XEN_IMM 0xEA1
+
+#ifdef CONFIG_ARM
+
+#include <asm/opcodes-virt.h>
+
+ENTRY(privcmd_call)
+ stmdb sp!, {r4}
+ mov r12, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ ldr r3, [sp, #8]
+ ldr r4, [sp, #4]
+ __HVC(XEN_IMM)
+ ldm sp!, {r4}
+ mov pc, lr
+ENDPROC(privcmd_call);
+
#define HYPERCALL_SIMPLE(hypercall) \
ENTRY(HYPERVISOR_##hypercall) \
mov r12, #__HYPERVISOR_##hypercall; \
- __HVC(XEN_IMM); \
- mov pc, lr; \
+ __HVC(XEN_IMM); \
+ mov pc, lr; \
+ENDPROC(HYPERVISOR_##hypercall)
+
+#define HYPERCALL5(hypercall) \
+ENTRY(HYPERVISOR_##hypercall) \
+ stmdb sp!, {r4} \
+ ldr r4, [sp, #4] \
+ mov r12, #__HYPERVISOR_##hypercall; \
+ __HVC(XEN_IMM); \
+ ldm sp!, {r4} \
+ mov pc, lr \
ENDPROC(HYPERVISOR_##hypercall)
+#else /* ARM64 specific code below */
+
+ENTRY(privcmd_call)
+ mov x16, x0
+ mov x0, x1
+ mov x1, x2
+ mov x2, x3
+ mov x3, x4
+ mov x4, x5
+ hvc XEN_IMM
+ ret
+ENDPROC(privcmd_call);
+
+#define HYPERCALL_SIMPLE(hypercall) \
+ENTRY(HYPERVISOR_##hypercall) \
+ mov x16, #__HYPERVISOR_##hypercall; \
+ hvc XEN_IMM; \
+ ret; \
+ENDPROC(HYPERVISOR_##hypercall)
+
+#define HYPERCALL5 HYPERCALL_SIMPLE
+#endif
+
+
#define HYPERCALL0 HYPERCALL_SIMPLE
#define HYPERCALL1 HYPERCALL_SIMPLE
#define HYPERCALL2 HYPERCALL_SIMPLE
#define HYPERCALL3 HYPERCALL_SIMPLE
#define HYPERCALL4 HYPERCALL_SIMPLE
-#define HYPERCALL5(hypercall) \
-ENTRY(HYPERVISOR_##hypercall) \
- stmdb sp!, {r4} \
- ldr r4, [sp, #4] \
- mov r12, #__HYPERVISOR_##hypercall; \
- __HVC(XEN_IMM); \
- ldm sp!, {r4} \
- mov pc, lr \
-ENDPROC(HYPERVISOR_##hypercall)
.text
@@ -89,15 +131,3 @@ HYPERCALL2(memory_op);
HYPERCALL2(physdev_op);
HYPERCALL3(vcpu_op);
-ENTRY(privcmd_call)
- stmdb sp!, {r4}
- mov r12, r0
- mov r0, r1
- mov r1, r2
- mov r2, r3
- ldr r3, [sp, #8]
- ldr r4, [sp, #4]
- __HVC(XEN_IMM)
- ldm sp!, {r4}
- mov pc, lr
-ENDPROC(privcmd_call);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 56b3f6d..b5d6ada 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -182,6 +182,16 @@ config HW_PERF_EVENTS
source "mm/Kconfig"
+config XEN_DOM0
+ def_bool y
+ depends on XEN
+
+config XEN
+ bool "Xen guest support on ARM64 (EXPERIMENTAL)"
+ depends on ARM64 && OF
+ help
+ Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64.
+
endmenu
menu "Boot options"
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index c95c5cb..4b298aa 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -37,6 +37,7 @@ TEXT_OFFSET := 0x00080000
export TEXT_OFFSET GZFLAGS
core-y += arch/arm64/kernel/ arch/arm64/mm/
+core-$(CONFIG_XEN) += arch/arm/xen/
libs-y := arch/arm64/lib/ $(libs-y)
libs-y += $(LIBGCC)
--
1.7.2.5
next prev parent reply other threads:[~2013-06-05 17:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 16:59 [PATCH v4 0/6] Introduce Xen support to ARM64 Stefano Stabellini
2013-06-05 17:02 ` [PATCH v4 1/6] arm/xen: define xen_remap as ioremap_cached Stefano Stabellini
2013-06-05 17:02 ` [PATCH v4 2/6] arm64/xen: introduce asm/xen header files on arm64 Stefano Stabellini
2013-06-05 17:02 ` [PATCH v4 3/6] arm64/xen: implement ioremap_cached " Stefano Stabellini
2013-06-05 17:02 ` [PATCH v4 4/6] arm64/xen: use XEN_IO_PROTO_ABI_ARM on ARM64 Stefano Stabellini
2013-06-05 17:02 ` Stefano Stabellini [this message]
2013-06-06 9:03 ` [Xen-devel] [PATCH v4 5/6] arm64/xen: introduce CONFIG_XEN " Ian Campbell
2013-06-06 9:27 ` Catalin Marinas
2013-06-06 9:29 ` Ian Campbell
2013-06-06 14:25 ` Catalin Marinas
2013-06-05 17:02 ` [PATCH v4 6/6] MAINTAINERS: add myself as arm64/xen maintainer Stefano Stabellini
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=1370451727-26826-5-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=catalin.marinas@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will.deacon@arm.com \
--cc=xen-devel@lists.xensource.com \
/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).