[PATCH 6/6] arm64: align hyp-stub opcodes

8 views
Skip to first unread message

Ralf Ramsauer

unread,
Jun 12, 2017, 10:18:05 AM6/12/17
to jailho...@googlegroups.com, Jan Kiszka, Ralf Ramsauer
Opcodes for arm64 Linux hyp-stub ABI switched since 4.12+. This patch
dynamically uses the correct opcode and preserves backward
compatibility.

Signed-off-by: Ralf Ramsauer <ralf.r...@oth-regensburg.de>
---
hypervisor/arch/arm64/asm-defines.c | 1 +
hypervisor/arch/arm64/entry.S | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/hypervisor/arch/arm64/asm-defines.c b/hypervisor/arch/arm64/asm-defines.c
index d850b1aa..ff5181ef 100644
--- a/hypervisor/arch/arm64/asm-defines.c
+++ b/hypervisor/arch/arm64/asm-defines.c
@@ -22,6 +22,7 @@ void common(void)
{
OFFSET(HEADER_MAX_CPUS, jailhouse_header, max_cpus);
OFFSET(HEADER_DEBUG_CONSOLE_VIRT, jailhouse_header, debug_console_base);
+ OFFSET(HEADER_HYP_STUB_VERSION, jailhouse_header, arm_hyp_info.version);
OFFSET(SYSCONFIG_DEBUG_CONSOLE_PHYS, jailhouse_system,
debug_console.address);
OFFSET(SYSCONFIG_HYPERVISOR_PHYS, jailhouse_system,
diff --git a/hypervisor/arch/arm64/entry.S b/hypervisor/arch/arm64/entry.S
index 8dfdb249..6f16b326 100644
--- a/hypervisor/arch/arm64/entry.S
+++ b/hypervisor/arch/arm64/entry.S
@@ -17,8 +17,10 @@
#include <asm/paging.h>
#include <asm/percpu.h>
#include <asm/jailhouse_hypercall.h>
+#include <jailhouse/header.h>

-#define LINUX_HVC_SET_VECTORS 1
+#define LINUX_HVC_SET_VECTORS_LEGACY 1
+#define LINUX_HVC_SET_VECTORS 0

/* x11 must contain the virt-to-phys offset */
.macro virt2phys, register
@@ -46,6 +48,7 @@ arch_entry:
* x15: virtual UART address
* x16: cpuid
* x17: caller lr
+ * x18: hyp-stub version
*/
mov x16, x0
mov x17, x30
@@ -56,6 +59,8 @@ arch_entry:
*/
adr x0, hypervisor_header

+ ldr x18, [x0, #HEADER_HYP_STUB_VERSION]
+
ldr x15, =UART_BASE

adrp x1, __page_pool
@@ -93,9 +98,15 @@ arch_entry:
*/

/* install bootstrap_vectors */
- mov x0, #LINUX_HVC_SET_VECTORS
ldr x1, =bootstrap_vectors
virt2phys x1
+
+ /* choose opcode */
+ mov x0, #LINUX_HVC_SET_VECTORS
+ cmp x18, #HYP_STUB_ABI_LEGACY
+ b.ne 1f
+ mov x0, #LINUX_HVC_SET_VECTORS_LEGACY
+1:
hvc #0

hvc #0 /* bootstrap vectors enter EL2 at el2_entry */
--
2.13.1

Reply all
Reply to author
Forward
0 new messages