From patchwork Wed Jul 1 16:29:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nastya Vicodin X-Patchwork-Id: 1321265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=h8Xs6Aqf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49yFpD6pGTz9sPF for ; Thu, 2 Jul 2020 21:13:40 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 710DC81C15; Thu, 2 Jul 2020 13:13:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="h8Xs6Aqf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2DE7481B48; Wed, 1 Jul 2020 18:30:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 64E0180030 for ; Wed, 1 Jul 2020 18:30:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vicooodin@gmail.com Received: by mail-lj1-x244.google.com with SMTP id f8so15604075ljc.2 for ; Wed, 01 Jul 2020 09:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5AoYVTFd6k/Tmo3+Oax0ufmSv3SNWpKMmyRfYg74Kk4=; b=h8Xs6Aqfc+kQ0hTR0CID+bI+wwdwp/X7sL4nrWgvdv0GdYL8S1DGzKMYrlwGdfgF5C 6tfIXIqd1wFBqJliB1/JJRvNpaXm1Bju1Zv+yACO8qJBd4nIS7rnmPHUPeZjh7i74cX9 1nf63zFlIItakf7hfO9HTOEZDUPzsWb7Yd53eIjF66WmGgaBuqTu3stjuNp5F9DLClWQ s1dqR/NVS1YXhtRfqSSiedS0o+iZdyRKbALV45c5hcSsdNAAiC3SXSEPeN/esiYGZp0p 7a+7Lrgs+xfYMo16nbavmkQKX23++SC5DsgjNw0PZ/wIrRCD2yBjsVlD7m+e43ezuukC WKEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5AoYVTFd6k/Tmo3+Oax0ufmSv3SNWpKMmyRfYg74Kk4=; b=SpK+8SzSFZbT19muQwQmvXRb6EUwnPUA+dj5/vF3BiPS6pR6CheTdA0a65bmq8/ZP2 67tUq6TxzZ/dssG8zYwOQvjLROdotmgR3o9pQAq5AEXwAMr21YIpJYRH/BX0TXRusu5w j90CSb7aDjJ7EWoXFwHiog6wW51wezHo4uY5NYyxaCOluJqURYNipgT/pOynokGvKTZr c+I8n9FtGt1izlsVw346KCKhW/xdaUG1aNM520b0qWm4u73xLO3JeyYj2lVLA0Q287Fk T9kq9tJ63715lCF8eYAfrRnwRXVg5P5L8qtI58bXZM/uRLlS3XDBwOtGwH8QVy4EJpB4 GeJg== X-Gm-Message-State: AOAM532A9UZkRx6DP7kOm1D7hzSNz+7sIcCr/s77E+TR7ZNzB4mXCT7X 8MljglkInNkIIydcCZpBpvOYTIddgPzqsQ== X-Google-Smtp-Source: ABdhPJweHCnNL+CDn+aA/wMZ3MwenSL5ns6d5D6Rd7OyKDSC+pWguy19kTEDgcQxjZgqiwz35P87mQ== X-Received: by 2002:a05:651c:23c:: with SMTP id z28mr7900211ljn.401.1593621001795; Wed, 01 Jul 2020 09:30:01 -0700 (PDT) Received: from localhost.localdomain (host-176-36-213-80.la.net.ua. [176.36.213.80]) by smtp.gmail.com with ESMTPSA id v20sm1943322lfr.74.2020.07.01.09.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 09:30:00 -0700 (PDT) From: Anastasiia Lukianenko To: u-boot@lists.denx.de, sjg@chromium.org, ye.li@nxp.com, bmeng.cn@gmail.com, xypron.glpk@gmx.de Cc: julien@xen.org, sstabellini@kernel.org, peng.fan@nxp.com, roman@zededa.com, volodymyr_babchuk@epam.com, Anastasiia Lukianenko Subject: [PATCH 00/17] Add new board: Xen guest for ARM64 Date: Wed, 1 Jul 2020 19:29:42 +0300 Message-Id: <20200701162959.9814-1-vicooodin@gmail.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 02 Jul 2020 13:12:53 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean 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