board: Introduce xenguest_arm64 board
Introduce a minimal Xen guest board running as a virtual machine under Xen Project's hypervisor [1], [2]. Part of the code is ported from Xen mini-os and also uses work initially done by different authors from NXP: please see relevant files for their copyrights. [1] https://xenbits.xen.org [2] https://wiki.xenproject.org/ Signed-off-by: Andrii Anisov <andrii_anisov@epam.com> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
This commit is contained in:
@@ -40,3 +40,4 @@ obj-$(CONFIG_TARGET_HIKEY) += hisilicon/
|
||||
obj-$(CONFIG_ARMV8_PSCI) += psci.o
|
||||
obj-$(CONFIG_ARCH_SUNXI) += lowlevel_init.o
|
||||
obj-$(CONFIG_TARGET_BCMNS3) += bcmns3/
|
||||
obj-$(CONFIG_XEN) += xen/
|
||||
|
||||
6
arch/arm/cpu/armv8/xen/Makefile
Normal file
6
arch/arm/cpu/armv8/xen/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
# (C) 2018 NXP
|
||||
# (C) 2020 EPAM Systems Inc.
|
||||
|
||||
obj-y += lowlevel_init.o hypercall.o
|
||||
79
arch/arm/cpu/armv8/xen/hypercall.S
Normal file
79
arch/arm/cpu/armv8/xen/hypercall.S
Normal file
@@ -0,0 +1,79 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* hypercall.S
|
||||
*
|
||||
* Xen hypercall wrappers
|
||||
*
|
||||
* Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
|
||||
*
|
||||
* 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; or, when distributed
|
||||
* separately from the Linux kernel or incorporated into other
|
||||
* software packages, subject to the following license:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this source file (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The Xen hypercall calling convention is very similar to the procedure
|
||||
* call standard for the ARM 64-bit architecture: the first parameter is
|
||||
* passed in x0, the second in x1, the third in x2, the fourth in x3 and
|
||||
* the fifth in x4.
|
||||
*
|
||||
* The hypercall number is passed in x16.
|
||||
*
|
||||
* The return value is in x0.
|
||||
*
|
||||
* The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
|
||||
* hypercall tag.
|
||||
*
|
||||
* Parameter structs passed to hypercalls are laid out according to
|
||||
* the ARM 64-bit EABI standard.
|
||||
*/
|
||||
|
||||
#include <xen/interface/xen.h>
|
||||
|
||||
#define XEN_HYPERCALL_TAG 0xEA1
|
||||
|
||||
#define HYPERCALL_SIMPLE(hypercall) \
|
||||
.globl HYPERVISOR_##hypercall; \
|
||||
.align 4,0x90; \
|
||||
HYPERVISOR_##hypercall: \
|
||||
mov x16, #__HYPERVISOR_##hypercall; \
|
||||
hvc XEN_HYPERCALL_TAG; \
|
||||
ret; \
|
||||
|
||||
#define HYPERCALL0 HYPERCALL_SIMPLE
|
||||
#define HYPERCALL1 HYPERCALL_SIMPLE
|
||||
#define HYPERCALL2 HYPERCALL_SIMPLE
|
||||
#define HYPERCALL3 HYPERCALL_SIMPLE
|
||||
#define HYPERCALL4 HYPERCALL_SIMPLE
|
||||
#define HYPERCALL5 HYPERCALL_SIMPLE
|
||||
|
||||
.text
|
||||
|
||||
HYPERCALL2(xen_version);
|
||||
HYPERCALL3(console_io);
|
||||
HYPERCALL3(grant_table_op);
|
||||
HYPERCALL2(sched_op);
|
||||
HYPERCALL2(event_channel_op);
|
||||
HYPERCALL2(hvm_op);
|
||||
HYPERCALL2(memory_op);
|
||||
|
||||
33
arch/arm/cpu/armv8/xen/lowlevel_init.S
Normal file
33
arch/arm/cpu/armv8/xen/lowlevel_init.S
Normal file
@@ -0,0 +1,33 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* (C) 2017 NXP
|
||||
* (C) 2020 EPAM Systems Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
.align 8
|
||||
.global rom_pointer
|
||||
rom_pointer:
|
||||
.space 32
|
||||
|
||||
/*
|
||||
* Routine: save_boot_params (called after reset from start.S)
|
||||
*/
|
||||
|
||||
.global save_boot_params
|
||||
save_boot_params:
|
||||
/* The firmware provided ATAG/FDT address can be found in r2/x0 */
|
||||
adr x1, rom_pointer
|
||||
stp x0, x2, [x1], #16
|
||||
stp x3, x4, [x1], #16
|
||||
|
||||
/* Returns */
|
||||
b save_boot_params_ret
|
||||
|
||||
.global restore_boot_params
|
||||
restore_boot_params:
|
||||
adr x1, rom_pointer
|
||||
ldp x0, x2, [x1], #16
|
||||
ldp x3, x4, [x1], #16
|
||||
ret
|
||||
Reference in New Issue
Block a user