From patchwork Wed Jul 1 16:29:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nastya Vicodin X-Patchwork-Id: 240618 List-Id: U-Boot discussion From: vicooodin at gmail.com (Anastasiia Lukianenko) Date: Wed, 1 Jul 2020 19:29:42 +0300 Subject: [PATCH 00/17] Add new board: Xen guest for ARM64 Message-ID: <20200701162959.9814-1-vicooodin@gmail.com> From: Anastasiia Lukianenko 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 [1] - https://xenproject.org/ [2] - https://wiki.xenproject.org/wiki/Paravirtualization_(PV) [3] - https://wiki.xenproject.org/wiki/Mini-OS [4] - https://source.codeaurora.org/external/imx/uboot-imx/tree/?h=imx_v2018.03_4.14.98_2.0.0_ga Anastasiia Lukianenko (5): 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 Andrii Anisov (2): board: Introduce xenguest_arm64 board lib: sscanf: add sscanf implementation Oleksandr Andrushchenko (8): armv8: Fix SMCC and ARM_PSCI_FW dependencies 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 | 7 + arch/arm/Kconfig | 10 +- arch/arm/cpu/armv8/Kconfig | 2 + arch/arm/cpu/armv8/Makefile | 1 + arch/arm/cpu/armv8/xen/Makefile | 6 + arch/arm/cpu/armv8/xen/hypercall.S | 78 ++ arch/arm/cpu/armv8/xen/lowlevel_init.S | 34 + arch/arm/include/asm/xen.h | 8 + arch/arm/include/asm/xen/hypercall.h | 45 ++ arch/arm/include/asm/xen/system.h | 96 +++ board/xen/xenguest_arm64/Kconfig | 12 + board/xen/xenguest_arm64/Makefile | 5 + board/xen/xenguest_arm64/xenguest_arm64.c | 203 +++++ cmd/Kconfig | 7 + cmd/Makefile | 1 + cmd/pvblock.c | 31 + common/board_r.c | 25 + configs/xenguest_arm64_defconfig | 60 ++ disk/part.c | 4 + 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 | 175 +++++ drivers/xen/Kconfig | 10 + drivers/xen/Makefile | 10 + drivers/xen/events.c | 181 +++++ drivers/xen/gnttab.c | 258 +++++++ drivers/xen/hypervisor.c | 289 +++++++ drivers/xen/pvblock.c | 808 ++++++++++++++++++++ drivers/xen/xenbus.c | 547 ++++++++++++++ include/blk.h | 1 + include/configs/xenguest_arm64.h | 53 ++ include/dm/uclass-id.h | 1 + include/linux/compat.h | 45 ++ include/pvblock.h | 12 + include/vsprintf.h | 8 + include/xen.h | 12 + include/xen/arm/interface.h | 88 +++ include/xen/events.h | 47 ++ include/xen/gnttab.h | 25 + include/xen/hvm.h | 30 + include/xen/interface/event_channel.h | 281 +++++++ include/xen/interface/grant_table.h | 582 ++++++++++++++ include/xen/interface/hvm/hvm_op.h | 69 ++ include/xen/interface/hvm/params.h | 127 ++++ include/xen/interface/io/blkif.h | 726 ++++++++++++++++++ include/xen/interface/io/console.h | 56 ++ include/xen/interface/io/protocols.h | 42 + include/xen/interface/io/ring.h | 479 ++++++++++++ include/xen/interface/io/xenbus.h | 81 ++ include/xen/interface/io/xs_wire.h | 151 ++++ include/xen/interface/memory.h | 332 ++++++++ include/xen/interface/sched.h | 188 +++++ include/xen/interface/xen.h | 225 ++++++ include/xen/xenbus.h | 86 +++ lib/Kconfig | 4 + lib/Makefile | 1 + lib/sscanf.c | 883 ++++++++++++++++++++++ 60 files changed, 7560 insertions(+), 1 deletion(-) 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 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