Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/arch/arm/core/aarch32/cortex_a_r/ @MaureenHelm @galak @ioannisg @bbolen @stephanosio
/arch/arm64/ @carlocaione
/arch/arm64/core/cortex_r/ @povergoing
/arch/arm64/core/xen/ @lorc @firscity
/arch/common/ @ioannisg @andyross
/soc/arc/snps_*/ @abrodkin @ruuddw @evgeniy-paltsev
/soc/nios2/ @nashif
Expand Down Expand Up @@ -60,7 +61,7 @@
/soc/arm64/qemu_cortex_a53/ @carlocaione
/soc/arm64/bcm_vk/ @abhishek-brcm
/soc/arm64/nxp_layerscape/ @JiafeiPan
/soc/arm64/xenvm/ @lorc
/soc/arm64/xenvm/ @lorc @firscity
/soc/arm64/arm/ @povergoing
/soc/arm64/arm/fvp_aemv8a/ @carlocaione
/submanifests/* @mbolivar-nordic
Expand Down Expand Up @@ -166,7 +167,7 @@
/boards/arm64/qemu_cortex_a53/ @carlocaione
/boards/arm64/bcm958402m2_a72/ @abhishek-brcm
/boards/arm64/nxp_ls1046ardb/ @JiafeiPan
/boards/arm64/xenvm/ @lorc
/boards/arm64/xenvm/ @lorc @firscity
/boards/arm64/fvp_baser_aemv8r/ @povergoing
/boards/arm64/fvp_base_revc_2xaemv8a/ @carlocaione
/boards/arm64/intel_socfpga_agilex_socdk/ @siclim @ngboonkhai
Expand Down Expand Up @@ -343,6 +344,8 @@
/drivers/serial/serial_test.c @str4t0m
/drivers/serial/*esp32c3* @uLipe
/drivers/serial/*esp32s2* @glaubermaroto
/drivers/serial/Kconfig.xen @lorc @firscity
/drivers/serial/uart_hvc_xen.c @lorc @firscity
/drivers/disk/ @jfischer-no
/drivers/disk/sdmmc_sdhc.h @JunYangNXP
/drivers/disk/sdmmc_spi.c @JunYangNXP
Expand Down Expand Up @@ -389,6 +392,7 @@
/drivers/wifi/eswifi/ @loicpoulain @nandojve
/drivers/wifi/winc1500/ @kludentwo
/drivers/virtualization/ @tbursztyka
/drivers/xen/ @lorc @firscity
/dts/arc/ @abrodkin @ruuddw @iriszzw @evgeniy-paltsev
/dts/arm/acsip/ @NorthernDean
/dts/arm/atmel/sam4e* @nandojve
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 10 additions & 0 deletions arch/arm64/core/xen/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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($<$<COMPILE_LANGUAGE:ASM>:-D__ASSEMBLY__>)

# Xen interface version used in headers for correct definition
zephyr_compile_options(-D__XEN_INTERFACE_VERSION__=0x00040e00)

zephyr_library_sources(hypercall.S)
26 changes: 26 additions & 0 deletions arch/arm64/core/xen/hypercall.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2021 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <toolchain.h>
#include <linker/sections.h>
#include <xen/public/arch-arm.h>
#include <xen/public/xen.h>

#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);
34 changes: 16 additions & 18 deletions boards/arm64/xenvm/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ It provides minimal set of devices:

* ARM Generic timer
* GICv2
* SBSA (subset of PL011) UART controller


Hardware
********
Expand All @@ -35,8 +33,6 @@ The following hardware features are supported:
+==============+=============+======================+
| GIC | virtualized | interrupt controller |
+--------------+-------------+----------------------+
| SBSA UART | emulated | serial port |
+--------------+-------------+----------------------+
| ARM TIMER | virtualized | system clock |
+--------------+-------------+----------------------+

Expand All @@ -57,13 +53,6 @@ boot log:

(XEN) [ 0.147541] Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 8320 KHz

Serial Port
-----------

This board configuration uses a single serial communication channel using SBSA
UART. This is a minimal UART implementation provided by Xen. Xen PV Console is
not supported at this moment.

Interrupt Controller
--------------------

Expand All @@ -88,13 +77,17 @@ configuration would not boot on your hardware. In this case you need to update
configuration by altering device tree and Kconfig options. This will be covered
in detail in next section.

No Xen-specific features are supported at the moment. This includes:
Most of Xen-specific features are not supported at the moment. This includes:

* Xen Enlighten memory page
* Xen Enlighten memory page (under development)
* XenBus
* Xen event channels
* Xen event channels (under development)
* Xen grant tables
* Xen PV drivers (including PV console)
* Xen PV drivers

Now only following features are supported:
* Xen PV console (UART-like driver with poll API, IRQ driven is under development)
* Xen early console_io interface (mainly for debug purposes)

Building and Running
********************
Expand All @@ -118,7 +111,6 @@ create guest configuration file :code:`zephyr.conf`. There is example:
memory=16
gic_version="v2"
on_crash="preserve"
vuart="sbsa_uart"

You need to upload both :code:`zephyr.bin` and :code:`zephyr.conf` to your Dom0
and then you can run Zephyr by issuing
Expand All @@ -127,11 +119,17 @@ and then you can run Zephyr by issuing

$ xl create zephyr.conf

Next you need to attach to SBSA virtual console:
Next you need to attach to PV console:

.. code-block::

$ xl console zephyr

Also this can be performed via single command:

.. code-block::

$ xl console -t vuart zephyr
$ xl create -c zephyr.conf

You will see Zephyr output:

Expand Down
13 changes: 4 additions & 9 deletions boards/arm64/xenvm/xenvm.dts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
#size-cells = <0x02>;

chosen {
zephyr,console = &sbsa;
zephyr,shell-uart = &sbsa;
zephyr,sram = &ram;
zephyr,console = &xen_hvc;
};

cpus {
Expand Down Expand Up @@ -78,12 +77,8 @@
interrupt-parent = <&gic>;
};

sbsa: sbsa-pl011@22000000 {
compatible = "arm,sbsa-uart";
reg = <0x00 0x22000000 0x00 0x1000>;
interrupts = <GIC_SPI 0x00 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
interrupt-parent = <&gic>;
current-speed = <0x1c200>;
label = "UART";
xen_hvc: hvc {
compatible = "xen,uart_hvc";
status = "okay";
};
};
10 changes: 6 additions & 4 deletions boards/arm64/xenvm/xenvm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ CONFIG_MAX_XLAT_TABLES=10
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable serial port
CONFIG_UART_PL011=y
CONFIG_UART_PL011_SBSA=y
CONFIG_UART_INTERRUPT_DRIVEN=n
# Enable PV hypervisor console
CONFIG_UART_XEN_HVC=y

# Enable logging subsys
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ add_subdirectory_ifdef(CONFIG_BBRAM bbram)
add_subdirectory_ifdef(CONFIG_FPGA fpga)
add_subdirectory_ifdef(CONFIG_PINCTRL pinctrl)
add_subdirectory_ifdef(CONFIG_MBOX mbox)
add_subdirectory_ifdef(CONFIG_BOARD_XENVM xen)
1 change: 1 addition & 0 deletions drivers/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ zephyr_library_sources_ifdef(CONFIG_UART_RCAR uart_rcar.c)
zephyr_library_sources_ifdef(CONFIG_UART_XEC uart_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_UART_NEORV32 uart_neorv32.c)
zephyr_library_sources_ifdef(CONFIG_USART_GD32 usart_gd32.c)
zephyr_library_sources_ifdef(CONFIG_UART_XEN_HVC uart_hvc_xen.c)

zephyr_library_sources_ifdef(CONFIG_USERSPACE uart_handlers.c)

Expand Down
2 changes: 2 additions & 0 deletions drivers/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,6 @@ source "drivers/serial/Kconfig.test"

source "drivers/serial/Kconfig.neorv32"

source "drivers/serial/Kconfig.xen"

endif # SERIAL
30 changes: 30 additions & 0 deletions drivers/serial/Kconfig.xen
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Xen hypervisor console via UART setup
#
# Copyright (c) 2021 EPAM Systems
# SPDX-License-Identifier: Apache-2.0
#

config UART_XEN_HVC
bool "Xen hypervisor console UART Driver"
select SERIAL_HAS_DRIVER
depends on BOARD_XENVM
default y
help
Enable Xen hypervisor console driver.

config XEN_HVC_INIT_PRIORITY
int "Xen hypervisor console init priority"
depends on UART_XEN_HVC
default 55
help
Set init priority for Xen HVC, should be inited before UART
console driver (HVC gets inited on PRE_KERNEL_1 stage).

config XEN_EARLY_CONSOLEIO
bool "Early printk/stdout through console_io Xen interface"
depends on BOARD_XENVM
default n
help
Enable setting of console_io symbol hook for stdout and printk.
Log output will become available on PRE_KERNEL_1 stage. Requires
Xen, compiled with CONFIG_DEBUG flag.
Loading