diff --git a/arch/arm64/core/CMakeLists.txt b/arch/arm64/core/CMakeLists.txt index 84013f2b5b6..1a0a5337bf8 100644 --- a/arch/arm64/core/CMakeLists.txt +++ b/arch/arm64/core/CMakeLists.txt @@ -30,3 +30,5 @@ if ((CONFIG_MP_NUM_CPUS GREATER 1) OR (CONFIG_SMP)) endif () zephyr_cc_option_ifdef(CONFIG_USERSPACE -mno-outline-atomics) + +add_subdirectory_ifdef(CONFIG_SOC_XENVM xen) diff --git a/arch/arm64/core/xen/CMakeLists.txt b/arch/arm64/core/xen/CMakeLists.txt new file mode 100644 index 00000000000..1009e655e69 --- /dev/null +++ b/arch/arm64/core/xen/CMakeLists.txt @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright (c) 2021 EPAM Systems + +# Needed to separate definitions in common Xen headers +zephyr_compile_options($<$:-D__ASSEMBLY__>) + +# Xen interface version used in headers for correct definition +zephyr_compile_options(-D__XEN_INTERFACE_VERSION__=0x00040e00) + +zephyr_library_sources(hypercall.S) diff --git a/arch/arm64/core/xen/hypercall.S b/arch/arm64/core/xen/hypercall.S new file mode 100644 index 00000000000..a9abdb003e0 --- /dev/null +++ b/arch/arm64/core/xen/hypercall.S @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021 EPAM Systems + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +#define HYPERCALL(hypercall) \ +GTEXT(HYPERVISOR_##hypercall); \ +SECTION_FUNC(TEXT, HYPERVISOR_##hypercall) \ + mov x16, #__HYPERVISOR_##hypercall; \ + hvc XEN_HYPERCALL_TAG; \ + ret; + +_ASM_FILE_PROLOGUE + +HYPERCALL(console_io); +HYPERCALL(grant_table_op); +HYPERCALL(sched_op); +HYPERCALL(event_channel_op); +HYPERCALL(hvm_op); +HYPERCALL(memory_op); diff --git a/include/arch/arm64/hypercall.h b/include/arch/arm64/hypercall.h new file mode 100644 index 00000000000..6fefdff12b0 --- /dev/null +++ b/include/arch/arm64/hypercall.h @@ -0,0 +1,12 @@ +/* + * Copyright (c() 2021 EPAM Systems + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* defined in hypercall.S by HYPERCALL(hypercall) */ +int HYPERVISOR_console_io(int op, int cnt, char *str); +int HYPERVISOR_sched_op(int op, void *param); +int HYPERVISOR_event_channel_op(int op, void *param); +int HYPERVISOR_hvm_op(int op, void *param); +int HYPERVISOR_memory_op(int op, void *param);