[RESEND PATCH v2 00/18] Add new board: Xen guest for ARM64

Anastasiia Lukianenko
2020-08-06T09:42:43Z

From: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>

This work introduces Xen [1] guest ARM64 board support in U-Boot with
para-virtualized (PV) [2] block and serial drivers: xenguest_arm64.

This board is to be run as a virtual Xen guest with U-boot as its
primary bootloader. The rationale behind introducing this board is a
better and simpler decoupling of the guest from the initial
privileged domain which starts a guest?s virtual machine: there are
cross dependencies between the guest OS and initial privileged domain
(Domain-0) such as Domain-0 needs guest's kernel and may need its
device tree to boot it. These dependencies interfere if the kernel or
guest OS needs to be updated, thus having a unified bootloader in
Domain-0 allows resolving this:
1. U-boot boot scripts, which are stored on the guest?s virtual disk,
are guest specific, so any change in the guest?s configuration can be
handled by the guest itself.
2. Guest OS? kernel can be updated if OS? needs that without any help
from Domain-0.
3. Using the Device Tree Overlay mechanism it is possible to customize
the device tree entries yet at bootloader stage inside the guest
itself, so the base device tree provided by Xen can be customized.

Xen support for U-boot was implemented by introducing a new Xen guest
ARM64 board and porting essential drivers from MiniOS [3] as well as
some of the work previously done by NXP [4]:
1. PV block device front driver with XenStore based device
enumeration, new UCLASS_PVBLOCK;
2. PV serial console device front driver;
3. Xen hypervisor support with minimal set of the essential headers
adapted from Linux kernel;
4. grant table support;
5. event channel support, without IRQ support, but polling;
6. xenbus support;
7. dynamic RAM size as defined in the device tree instead of
statically defined values;
8. position-independent pre-relocation code is used as we cannot
statically define any start addresses at compile time which is up to
Xen to choose at run-time;
9. new defconfig introduced: xenguest_arm64_defconfig.

Please note, that due to the fact that para-virtualized serial driver
requires some of the Xen functionality available late not all the
printouts are available at the very start including U-Boot banner,
memory size etc.

All the above was tested with block driver related commands
(info/part/read/write), FAT and ext4 operations work properly, the
Linux kernel can start.

Thank you in advance,
Anastasiia Lukianenko,
Oleksandr Andrushchenko

Changes since v1:
=================

1. Added test for new lib sscanf function
2. Fixed data cache maintenance process
3. Added more comments and explanations
4. Removed unnecessary code, which is not related to ARM64 architecture
5. Added board documentation
6. Coding style cleanup
7. Added MIT License

Anastasiia Lukianenko (7):
Add MIT License
xen: pvblock: Add initial support for para-virtualized block driver
xen: pvblock: Enumerate virtual block devices
xen: pvblock: Read XenStore configuration and initialize
xen: pvblock: Implement front-back protocol and do IO
xen: pvblock: Print found devices indices
doc: xen: Add Xen guest ARM64 board documentation

Andrii Anisov (2):
board: Introduce xenguest_arm64 board
lib: sscanf: add sscanf implementation

Oleksandr Andrushchenko (7):
xen: Add essential and required interface headers
xen: Port Xen hypervizor related code from mini-os
xen: Port Xen event channel driver from mini-os
linux/compat.h: Add wait_event_timeout macro
xen: Port Xen bus driver from mini-os
xen: Port Xen grant table driver from mini-os
board: xen: De-initialize before jumping to Linux

Peng Fan (2):
Kconfig: Introduce CONFIG_XEN
serial: serial_xen: Add Xen PV serial driver

Kconfig | 18 +
Licenses/README | 1 +
Licenses/mit.txt | 20 +
arch/arm/Kconfig | 9 +
arch/arm/cpu/armv8/Makefile | 1 +
arch/arm/cpu/armv8/xen/Makefile | 6 +
arch/arm/cpu/armv8/xen/hypercall.S | 79 ++
arch/arm/cpu/armv8/xen/lowlevel_init.S | 33 +
arch/arm/include/asm/io.h | 4 +
arch/arm/include/asm/xen.h | 7 +
arch/arm/include/asm/xen/hypercall.h | 22 +
arch/arm/include/asm/xen/system.h | 88 +++
board/xen/xenguest_arm64/Kconfig | 12 +
board/xen/xenguest_arm64/Makefile | 5 +
board/xen/xenguest_arm64/xenguest_arm64.c | 202 +++++
cmd/Kconfig | 7 +
cmd/Makefile | 1 +
cmd/pvblock.c | 30 +
common/board_r.c | 27 +
configs/xenguest_arm64_defconfig | 60 ++
disk/part.c | 4 +
doc/board/index.rst | 1 +
doc/board/xen/index.rst | 9 +
doc/board/xen/xenguest_arm64.rst | 81 ++
drivers/Kconfig | 2 +
drivers/Makefile | 1 +
drivers/block/blk-uclass.c | 2 +
drivers/serial/Kconfig | 7 +
drivers/serial/Makefile | 1 +
drivers/serial/serial_xen.c | 182 +++++
drivers/xen/Kconfig | 10 +
drivers/xen/Makefile | 10 +
drivers/xen/events.c | 199 +++++
drivers/xen/gnttab.c | 216 ++++++
drivers/xen/hypervisor.c | 252 +++++++
drivers/xen/pvblock.c | 867 ++++++++++++++++++++++
drivers/xen/xenbus.c | 557 ++++++++++++++
include/blk.h | 1 +
include/configs/xenguest_arm64.h | 52 ++
include/dm/uclass-id.h | 1 +
include/linux/compat.h | 54 ++
include/pvblock.h | 17 +
include/vsprintf.h | 8 +
include/xen.h | 24 +
include/xen/arm/interface.h | 88 +++
include/xen/events.h | 42 ++
include/xen/gnttab.h | 24 +
include/xen/hvm.h | 27 +
include/xen/interface/event_channel.h | 279 +++++++
include/xen/interface/grant_table.h | 565 ++++++++++++++
include/xen/interface/hvm/hvm_op.h | 55 ++
include/xen/interface/hvm/params.h | 116 +++
include/xen/interface/io/blkif.h | 701 +++++++++++++++++
include/xen/interface/io/console.h | 39 +
include/xen/interface/io/protocols.h | 28 +
include/xen/interface/io/ring.h | 462 ++++++++++++
include/xen/interface/io/xenbus.h | 64 ++
include/xen/interface/io/xs_wire.h | 134 ++++
include/xen/interface/memory.h | 332 +++++++++
include/xen/interface/sched.h | 171 +++++
include/xen/interface/xen.h | 208 ++++++
include/xen/xenbus.h | 116 +++
lib/Kconfig | 4 +
lib/Makefile | 1 +
lib/sscanf.c | 823 ++++++++++++++++++++
test/lib/Makefile | 1 +
test/lib/sscanf.c | 174 +++++
67 files changed, 7644 insertions(+)
create mode 100644 Licenses/mit.txt
create mode 100644 arch/arm/cpu/armv8/xen/Makefile
create mode 100644 arch/arm/cpu/armv8/xen/hypercall.S
create mode 100644 arch/arm/cpu/armv8/xen/lowlevel_init.S
create mode 100644 arch/arm/include/asm/xen.h
create mode 100644 arch/arm/include/asm/xen/hypercall.h
create mode 100644 arch/arm/include/asm/xen/system.h
create mode 100644 board/xen/xenguest_arm64/Kconfig
create mode 100644 board/xen/xenguest_arm64/Makefile
create mode 100644 board/xen/xenguest_arm64/xenguest_arm64.c
create mode 100644 cmd/pvblock.c
create mode 100644 configs/xenguest_arm64_defconfig
create mode 100644 doc/board/xen/index.rst
create mode 100644 doc/board/xen/xenguest_arm64.rst
create mode 100644 drivers/serial/serial_xen.c
create mode 100644 drivers/xen/Kconfig
create mode 100644 drivers/xen/Makefile
create mode 100644 drivers/xen/events.c
create mode 100644 drivers/xen/gnttab.c
create mode 100644 drivers/xen/hypervisor.c
create mode 100644 drivers/xen/pvblock.c
create mode 100644 drivers/xen/xenbus.c
create mode 100644 include/configs/xenguest_arm64.h
create mode 100644 include/pvblock.h
create mode 100644 include/xen.h
create mode 100644 include/xen/arm/interface.h
create mode 100644 include/xen/events.h
create mode 100644 include/xen/gnttab.h
create mode 100644 include/xen/hvm.h
create mode 100644 include/xen/interface/event_channel.h
create mode 100644 include/xen/interface/grant_table.h
create mode 100644 include/xen/interface/hvm/hvm_op.h
create mode 100644 include/xen/interface/hvm/params.h
create mode 100644 include/xen/interface/io/blkif.h
create mode 100644 include/xen/interface/io/console.h
create mode 100644 include/xen/interface/io/protocols.h
create mode 100644 include/xen/interface/io/ring.h
create mode 100644 include/xen/interface/io/xenbus.h
create mode 100644 include/xen/interface/io/xs_wire.h
create mode 100644 include/xen/interface/memory.h
create mode 100644 include/xen/interface/sched.h
create mode 100644 include/xen/interface/xen.h
create mode 100644 include/xen/xenbus.h
create mode 100644 lib/sscanf.c
create mode 100644 test/lib/sscanf.c

--
2.17.1