zephyr/snippets/xen_dom0/README.rst
Dmytro Firsov 5207c6f3f9 snippets: add virtual Xen dom0 snippet support
Zephyr snippets allow to apply pre-defined build configuration and
extentions to your build0. It is made by applying generic snippet
conf/device-tree changes and may be extended with platform-specific
files.

It looks like great approach for convertion Zephyr OS build to Xen
control domain on different boards, as it requires Kconfig changes
and board device tree changes (configuration for memory node, hypervisor
console, grant table region etc).

Please note, that Xen hypervisor passes all selected parameters via
domain device-tree, but Zephyr does not use it in runtime. So, user
should keep values in board overlays in sync with real Xen values.

Add example and docs for converting qemu_cortex_a53 board to Xen
Domain-0 guest. This approach might be used for other boards, where
Zephyr Dom0 is needed.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00

52 lines
1.9 KiB
ReStructuredText

.. _xen_dom0:
Xen Dom0: universal snippet for XEN control domain
##################################################
Overview
********
This snippet allows user to build Zephyr as a Xen initial domain (Dom0). The feature
is implemented as configuration snippet to allow support for any compatible platform.
How to add support of a new board
*********************************
* add board dts overlay to this snippet which deletes/adds memory and deletes UART nodes;
* add correct memory and hypervisor nodes, based on regions Xen picked for Domain-0 on your setup.
Programming
***********
Correct snippet designation for Xen must
be entered when you invoke ``west build``.
For example:
.. code-block:: console
west build -b qemu_cortex_a53 -S xen_dom0 samples/synchronization
QEMU example with Xen
***********************
Overlay for qemu_cortex_a53 board, that is present in `board/` directory of this snippet is QEMU
Xen control domain example. To run such setup, you need to:
* fetch and build Xen (e.g. RELEASE-4.17.0) for arm64 platform
* take and compile sample device tree from `example/` directory
* build your Zephyr sample/application with `xen_dom0` snippet and start it as Xen control domain
For starting you can use QEMU from Zephyr SDK by following command:
.. code-block:: console
<path to Zephyr SDK>/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-aarch64 -cpu cortex-a53 \
-m 6G -nographic -machine virt,gic-version=3,virtualization=true -chardev stdio,id=con,mux=on \
-serial chardev:con -mon chardev=con,mode=readline -pidfile qemu.pid \
-device loader,file=<path to Zephyr app build>/zephyr.bin,addr=0x40600000 \
-dtb <path to DTB>/xen.dtb -kernel <path to Xen build>/xen
This will start you a Xen hypervisor with your application as Xen control domain. To make it usable,
you can add `zephyr-xenlib` by Xen-troops library to your project. It'll provide basic domain
management functionalities - domain creation and configuration.