From 4028c726be78adc1f1df3708dbe99f9eb2303790 Mon Sep 17 00:00:00 2001 From: Leonid Lazarev Date: Fri, 15 May 2020 11:51:48 +0300 Subject: Raspberry 4: XEN support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added the support for DOM0 in raspberry pi4. The feature agl-virt-xen should be enabled to activate this code. 1512 MB of memory is used for DOM0 machine. There are limitations: - brcmfmac module disabled (bluethooth and Wifi) due to the crash - total_memory is set to the 3Gb, as it impacts the USB ports on rasbperry pi4 on Linux kernel 4.19 v2 (jsmoeller): make changes in virtualization-layer conditional to raspberrypi4 Bug-AGL: SPEC-3259 Change-Id: I873fbf1f5498e31ae5f468407502f16e1873f7fc Signed-off-by: Leonid Lazarev Signed-off-by: Jan-Simon Möller Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/24522 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account --- .../recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd | 45 ++++++++++++++++++++++ .../rpi-u-boot-scr/rpi-u-boot-scr.bbappend | 18 +++++++++ 2 files changed, 63 insertions(+) create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend (limited to 'meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr') diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd new file mode 100644 index 000000000..24cfb1658 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot_xen.cmd @@ -0,0 +1,45 @@ +# +# SPDX-License-Identifier: MIT +# +# Copyright (c) 2020, MERA +# +# Author: Leonid Lazarev +# +# Xen Boot Script +# +# https://www.raspberrypi.org/documentation/configuration/device-tree.md +# We do not set fdt_addr, because device tree initially is loaded by raspberry pi firmware loader and the particular +# modification are performed. The prepared DTS is propagated to u-boot and this prepared device tree has to be reused. + +setenv kernel_addr_r 0x00480000 # 16M +setenv xen_addr_r 0x00200000 # 2M + +# Load xen to ${xen_addr_r}. +fatload mmc 0:1 ${xen_addr_r} /xen-@@MACHINE@@ + +#configure dom0 +fdt addr ${fdt_addr} + +#read prepared bootargs, rapsberry pi prepared initial list of the parameters for loading +fdt get value bootargs /chosen bootargs +fdt resize 8192 + +# add device type for raspberry +fdt set pcie0 device_type "pci" + +fdt chosen +fdt set /chosen \#address-cells <1> +fdt set /chosen \#size-cells <1> + +# Load Linux Image to ${kernel_addr_r} +fatload mmc 0:1 ${kernel_addr_r} /@@KERNEL_IMAGETYPE@@ + +# we load dom0 with 1512 MB of memory +fdt mknod /chosen dom0 +fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=/soc/serial@7e215040 sync_console dom0_mem=1512M bootscrub=0" +fdt set /chosen xen,dom0-bootargs "${bootargs}" + +fdt set /chosen/dom0 compatible "xen,linux-zimage", "xen,multiboot-module" +fdt set /chosen/dom0 reg <${kernel_addr_r} 0x${filesize} > + +@@KERNEL_BOOTCMD@@ ${xen_addr_r} - ${fdt_addr} diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend new file mode 100644 index 000000000..2437d9a84 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bbappend @@ -0,0 +1,18 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI_append =" \ + ${@bb.utils.contains('AGL_XEN_WANTED','1',' file://boot_xen.cmd','',d)} \ +" + +do_compile_append() { + + # if xen feature is activated we overwirte the boot script with xen specific one + if [ "${AGL_XEN_WANTED}" = "1" ]; then + sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ + -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ + -e 's/@@MACHINE@@/${MACHINE}/' \ + "${WORKDIR}/boot_xen.cmd" > "${WORKDIR}/boot.cmd" + + mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr + fi +} \ No newline at end of file -- cgit 1.2.3-korg