Skip to content

Commit 45c2542

Browse files
committed
arm64: xenvm: Add Xen hypercall interface for arm64
This commit adds Xen hypervisor call interface for arm64 architecture. This is needed for further development of Xen features in Zephyr. Signed-off-by: Dmytro Firsov <[email protected]>
1 parent 8afa764 commit 45c2542

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

arch/arm64/core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ endif ()
3131
add_subdirectory_ifdef(CONFIG_ARM_MPU cortex_r/mpu)
3232

3333
zephyr_cc_option_ifdef(CONFIG_USERSPACE -mno-outline-atomics)
34+
35+
add_subdirectory_ifdef(CONFIG_SOC_XENVM xen)

arch/arm64/core/xen/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (c) 2021 EPAM Systems
3+
4+
# Needed to separate definitions in common Xen headers
5+
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:-D__ASSEMBLY__>)
6+
7+
# Xen interface version used in headers for correct definition
8+
zephyr_compile_options(-D__XEN_INTERFACE_VERSION__=0x00040e00)
9+
10+
zephyr_library_sources(hypercall.S)

arch/arm64/core/xen/hypercall.S

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2021 EPAM Systems
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <toolchain.h>
8+
#include <linker/sections.h>
9+
#include <xen/public/arch-arm.h>
10+
#include <xen/public/xen.h>
11+
12+
#define HYPERCALL(hypercall) \
13+
GTEXT(HYPERVISOR_##hypercall); \
14+
SECTION_FUNC(TEXT, HYPERVISOR_##hypercall) \
15+
mov x16, #__HYPERVISOR_##hypercall; \
16+
hvc XEN_HYPERCALL_TAG; \
17+
ret;
18+
19+
_ASM_FILE_PROLOGUE
20+
21+
HYPERCALL(console_io);
22+
HYPERCALL(grant_table_op);
23+
HYPERCALL(sched_op);
24+
HYPERCALL(event_channel_op);
25+
HYPERCALL(hvm_op);
26+
HYPERCALL(memory_op);

include/arch/arm64/hypercall.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c() 2021 EPAM Systems
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* defined in hypercall.S by HYPERCALL(hypercall) */
8+
int HYPERVISOR_console_io(int op, int cnt, char *str);
9+
int HYPERVISOR_sched_op(int op, void *param);
10+
int HYPERVISOR_event_channel_op(int op, void *param);
11+
int HYPERVISOR_hvm_op(int op, void *param);
12+
int HYPERVISOR_memory_op(int op, void *param);

0 commit comments

Comments
 (0)