summaryrefslogtreecommitdiffstats
path: root/meta-agl-jailhouse
diff options
context:
space:
mode:
Diffstat (limited to 'meta-agl-jailhouse')
-rw-r--r--meta-agl-jailhouse/README.md3
-rw-r--r--meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend4
-rw-r--r--meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-dt-dtoverlays-Add-jailhouse-memory-DT-overlay.patch87
-rw-r--r--meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend2
-rw-r--r--meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4%.bbappend5
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse/0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch290
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse_git.bb6
7 files changed, 392 insertions, 5 deletions
diff --git a/meta-agl-jailhouse/README.md b/meta-agl-jailhouse/README.md
index fb0a3d42..c4a32bfd 100644
--- a/meta-agl-jailhouse/README.md
+++ b/meta-agl-jailhouse/README.md
@@ -33,8 +33,7 @@ This layer depends on:
## Supported targets
* Raspberry Pi 4
- * Currently only the 1 GB RAM variant. The other ones will work too,
- but will be limited to 1 GB of memory.
+ * All (1G-8G) memory variants. But note that there is 256M reserved for Jailhouse and 256MiB for GPU in AGL, so the smaller variants are not recommended.
* QEMU x86-64
* Work in progress. Requires KVM. Nested virtualization must be enabled on the host. Currently, the right configuration of QEMU and Jailhouse to work out-of-box is being worked on.
diff --git a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
index 178c982a..687980cf 100644
--- a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
+++ b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend
@@ -21,6 +21,10 @@ do_deploy_append_raspberrypi4() {
echo "# Enable CAN (Waveshare RS485 CAN HAT)" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
echo "dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=1000000" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ # memory reserved for Jailhouse
+ echo "dtoverlay=jailhouse-memory" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+ echo "dtoverlay=jailhouse-memory,start=0xe0000000,size=0x200000" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+
}
diff --git a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-dt-dtoverlays-Add-jailhouse-memory-DT-overlay.patch b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-dt-dtoverlays-Add-jailhouse-memory-DT-overlay.patch
new file mode 100644
index 00000000..1b6373cc
--- /dev/null
+++ b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-dt-dtoverlays-Add-jailhouse-memory-DT-overlay.patch
@@ -0,0 +1,87 @@
+From c6319fb59e0cd5b6d3d4e3401abd9c2057059a74 Mon Sep 17 00:00:00 2001
+From: Jakub Luzny <jakub@luzny.cz>
+Date: Tue, 11 Aug 2020 10:40:18 +0200
+Subject: [PATCH] dt/dtoverlays: Add jailhouse-memory DT overlay
+
+It is meant to reserve memory that can be used by the Jailhouse partitioning
+hypervisor. More regions can be reserved.
+
+Upstream-Status: Inappropriate [Jailhouse specific]
+
+Signed-off-by: Jakub Luzny <jakub@luzny.cz>
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 7 +++++
+ .../boot/dts/overlays/jailhouse-memory-overlay.dts | 30 ++++++++++++++++++++++
+ 3 files changed, 38 insertions(+)
+ create mode 100644 arch/arm/boot/dts/overlays/jailhouse-memory-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index fa6db6eed3e2..38c61c67606d 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -92,6 +92,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
+ iqaudio-dacplus.dtbo \
+ iqaudio-digi-wm8804-audio.dtbo \
+ irs1125.dtbo \
++ jailhouse-memory.dtbo \
+ jedec-spi-nor.dtbo \
+ justboom-both.dtbo \
+ justboom-dac.dtbo \
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 69892d01faae..4a62f204b4f9 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -1528,6 +1528,13 @@ Load: dtoverlay=irs1125
+ Params: <None>
+
+
++Name: jailhouse-memory
++Info: Reserves memory for use by the Jailhouse hypervisor
++Load: dtoverlay=jailhouse-memory,<param>=<val>
++Params: start Start of the reserved memory area (default 0x20000000)
++ size Size of the reserved memory area (default 0x10000000)
++
++
+ Name: jedec-spi-nor
+ Info: Adds support for JEDEC-compliant SPI NOR flash devices. (Note: The
+ "jedec,spi-nor" kernel driver was formerly known as "m25p80".)
+diff --git a/arch/arm/boot/dts/overlays/jailhouse-memory-overlay.dts b/arch/arm/boot/dts/overlays/jailhouse-memory-overlay.dts
+new file mode 100644
+index 000000000000..26c3ce6b9e3d
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/jailhouse-memory-overlay.dts
+@@ -0,0 +1,30 @@
++// Reserves memory for use by the Jailhouse hypervisor
++/dts-v1/;
++/plugin/;
++
++/ {
++ compatible = "brcm,bcm2835";
++
++ fragment@0 {
++ target-path = "/";
++ __overlay__ {
++
++ reserved-memory {
++ #address-cells = <2>;
++ #size-cells = <1>;
++
++ ranges;
++
++ jailhouse_memory: jailhouse@20000000 {
++ reg = <0x0 0x20000000 0x10000000>;
++ no-map;
++ };
++ };
++ };
++ };
++
++ __overrides__ {
++ start = <&jailhouse_memory>,"reg#0";
++ size = <&jailhouse_memory>,"reg:8";
++ };
++};
+--
+2.11.0
+
diff --git a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
deleted file mode 100644
index 0616c06e..00000000
--- a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
-# required for Jailhouse to work with the supplied cell confiugrations
-CMDLINE_append = " mem=768M" \ No newline at end of file
diff --git a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4%.bbappend b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4%.bbappend
index 7e37d21b..1456fdc8 100644
--- a/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4%.bbappend
+++ b/meta-agl-jailhouse/dynamic-layers/raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4%.bbappend
@@ -1,3 +1,8 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-dt-dtoverlays-Add-jailhouse-memory-DT-overlay.patch"
+
+
LINUX_VERSION = "5.4.51"
SRCREV = "2c8ec3bb4403a7c76c22ec6d3d5fc4b2a366024e"
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse/0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch b/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse/0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch
new file mode 100644
index 00000000..21d5f2f1
--- /dev/null
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse/0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch
@@ -0,0 +1,290 @@
+From 4f86ca866119669a75f02ea10fa502f051f8240c Mon Sep 17 00:00:00 2001
+From: Jakub Luzny <jakub@luzny.cz>
+Date: Tue, 11 Aug 2020 11:45:02 +0200
+Subject: [PATCH] configs: arm64: Add support for RPi4 with more than 1G of
+ memory
+
+Add the required memory regions to support 2G, 4G and 8G RAM variants
+of the Raspberry Pi 4. Tested on all the bigger variants, not on 1G, as I don't
+have one on hand and it's not available anymore.
+
+Also moved the memory used by Jailhouse for the hypervisor and cells from
+0x30000000 to 0x20000000 to avoid conflict with GPU memory. That is fine for
+gpu_mem setting of up to 256. The memory is supposed to be reserved using
+reserved-memory node in the device tree. To support variants with >2G RAM,
+another region for PCI MMIO space has to be also reserved.
+
+Upstream-Status: Submitted [jailhouse-dev@googlegroups.com]
+
+Signed-off-by: Jakub Luzny <jakub@luzny.cz>
+---
+ configs/arm64/rpi4-inmate-demo.c | 22 ++++++------
+ configs/arm64/rpi4-linux-demo.c | 28 +++++++--------
+ configs/arm64/rpi4.c | 62 +++++++++++++++++++++++---------
+ 3 files changed, 71 insertions(+), 41 deletions(-)
+
+diff --git a/configs/arm64/rpi4-inmate-demo.c b/configs/arm64/rpi4-inmate-demo.c
+index 62442e7c..09dfc1f0 100644
+--- a/configs/arm64/rpi4-inmate-demo.c
++++ b/configs/arm64/rpi4-inmate-demo.c
+@@ -51,34 +51,34 @@ struct {
+ .mem_regions = {
+ /* IVSHMEM shared memory regions (demo) */
+ {
+- .phys_start = 0x3faf0000,
+- .virt_start = 0x3faf0000,
++ .phys_start = 0x2faf0000,
++ .virt_start = 0x2faf0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3faf1000,
+- .virt_start = 0x3faf1000,
++ .phys_start = 0x2faf1000,
++ .virt_start = 0x2faf1000,
+ .size = 0x9000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafa000,
+- .virt_start = 0x3fafa000,
++ .phys_start = 0x2fafa000,
++ .virt_start = 0x2fafa000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafc000,
+- .virt_start = 0x3fafc000,
++ .phys_start = 0x2fafc000,
++ .virt_start = 0x2fafc000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafe000,
+- .virt_start = 0x3fafe000,
++ .phys_start = 0x2fafe000,
++ .virt_start = 0x2fafe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+@@ -91,7 +91,7 @@ struct {
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ /* RAM */ {
+- .phys_start = 0x3fa00000,
++ .phys_start = 0x2fa00000,
+ .virt_start = 0,
+ .size = 0x00010000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+diff --git a/configs/arm64/rpi4-linux-demo.c b/configs/arm64/rpi4-linux-demo.c
+index 9e7fad26..cf36fa22 100644
+--- a/configs/arm64/rpi4-linux-demo.c
++++ b/configs/arm64/rpi4-linux-demo.c
+@@ -52,39 +52,39 @@ struct {
+ .mem_regions = {
+ /* IVSHMEM shared memory regions (demo) */
+ {
+- .phys_start = 0x3faf0000,
+- .virt_start = 0x3faf0000,
++ .phys_start = 0x2faf0000,
++ .virt_start = 0x2faf0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3faf1000,
+- .virt_start = 0x3faf1000,
++ .phys_start = 0x2faf1000,
++ .virt_start = 0x2faf1000,
+ .size = 0x9000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafa000,
+- .virt_start = 0x3fafa000,
++ .phys_start = 0x2fafa000,
++ .virt_start = 0x2fafa000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafc000,
+- .virt_start = 0x3fafc000,
++ .phys_start = 0x2fafc000,
++ .virt_start = 0x2fafc000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+- .phys_start = 0x3fafe000,
+- .virt_start = 0x3fafe000,
++ .phys_start = 0x2fafe000,
++ .virt_start = 0x2fafe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ /* IVSHMEM shared memory region */
+- JAILHOUSE_SHMEM_NET_REGIONS(0x3fb00000, 1),
++ JAILHOUSE_SHMEM_NET_REGIONS(0x2fb00000, 1),
+ /* UART */ {
+ .phys_start = 0xfe215040,
+ .virt_start = 0xfe215040,
+@@ -94,15 +94,15 @@ struct {
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ /* RAM */ {
+- .phys_start = 0x3f900000,
++ .phys_start = 0x2f900000,
+ .virt_start = 0,
+ .size = 0x10000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
+ },
+ /* RAM */ {
+- .phys_start = 0x30000000,
+- .virt_start = 0x30000000,
++ .phys_start = 0x20000000,
++ .virt_start = 0x20000000,
+ .size = 0x8000000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA |
+diff --git a/configs/arm64/rpi4.c b/configs/arm64/rpi4.c
+index 92463184..c25bd8d2 100644
+--- a/configs/arm64/rpi4.c
++++ b/configs/arm64/rpi4.c
+@@ -1,7 +1,7 @@
+ /*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+- * Test configuration for Raspberry Pi 4 (32-bit, quad-core Cortex-A72, 1GB RAM)
++ * Test configuration for Raspberry Pi 4 (32-bit, quad-core Cortex-A72, 1GB, 2GB, 4GB or 8GB RAM)
+ *
+ * Copyright (c) Siemens AG, 2020
+ *
+@@ -10,6 +10,9 @@
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
++ *
++ * Reservation via device tree: reg = <0x0 0x20000000 0x10000000>;
++ * reg = <0x0 0xe0000000 0x200000>;
+ */
+
+ #include <jailhouse/types.h>
+@@ -18,7 +21,7 @@
+ struct {
+ struct jailhouse_system header;
+ __u64 cpus[1];
+- struct jailhouse_memory mem_regions[12];
++ struct jailhouse_memory mem_regions[15];
+ struct jailhouse_irqchip irqchips[2];
+ struct jailhouse_pci_device pci_devices[2];
+ } __attribute__((packed)) config = {
+@@ -27,7 +30,7 @@ struct {
+ .revision = JAILHOUSE_CONFIG_REVISION,
+ .flags = JAILHOUSE_SYS_VIRTUAL_DEBUG_CONSOLE,
+ .hypervisor_memory = {
+- .phys_start = 0x3fc00000,
++ .phys_start = 0x2fc00000,
+ .size = 0x00400000,
+ },
+ .debug_console = {
+@@ -70,37 +73,37 @@ struct {
+ .mem_regions = {
+ /* IVSHMEM shared memory regions for 00:00.0 (demo) */
+ {
+- .phys_start = 0x3faf0000,
+- .virt_start = 0x3faf0000,
++ .phys_start = 0x2faf0000,
++ .virt_start = 0x2faf0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ,
+ },
+ {
+- .phys_start = 0x3faf1000,
+- .virt_start = 0x3faf1000,
++ .phys_start = 0x2faf1000,
++ .virt_start = 0x2faf1000,
+ .size = 0x9000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+ },
+ {
+- .phys_start = 0x3fafa000,
+- .virt_start = 0x3fafa000,
++ .phys_start = 0x2fafa000,
++ .virt_start = 0x2fafa000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+ },
+ {
+- .phys_start = 0x3fafc000,
+- .virt_start = 0x3fafc000,
++ .phys_start = 0x2fafc000,
++ .virt_start = 0x2fafc000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ,
+ },
+ {
+- .phys_start = 0x3fafe000,
+- .virt_start = 0x3fafe000,
++ .phys_start = 0x2fafe000,
++ .virt_start = 0x2fafe000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ,
+ },
+ /* IVSHMEM shared memory regions for 00:01.0 (networking) */
+- JAILHOUSE_SHMEM_NET_REGIONS(0x3fb00000, 0),
++ JAILHOUSE_SHMEM_NET_REGIONS(0x2fb00000, 0),
+ /* MMIO 1 (permissive) */ {
+ .phys_start = 0xfd500000,
+ .virt_start = 0xfd500000,
+@@ -115,10 +118,37 @@ struct {
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_IO,
+ },
+- /* RAM */ {
++ /* RAM (0M-~762M) */ {
+ .phys_start = 0x0,
+ .virt_start = 0x0,
+- .size = 0x3fa10000,
++ .size = 0x2fa10000,
++ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
++ JAILHOUSE_MEM_EXECUTE,
++ },
++
++ /* ~6M reserved for the hypervisor and the shared memory regions */
++
++ /* RAM (768M-3584M) */ {
++ .phys_start = 0x30000000,
++ .virt_start = 0x30000000,
++ .size = 0xb0000000,
++ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
++ JAILHOUSE_MEM_EXECUTE,
++ },
++
++ /* 2M reserved for PCI MMIO space */
++
++ /* RAM (3586M-4032M) */ {
++ .phys_start = 0xe0200000,
++ .virt_start = 0xe0200000,
++ .size = 0x1be00000,
++ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
++ JAILHOUSE_MEM_EXECUTE,
++ },
++ /* RAM (4096M-8192M) */ {
++ .phys_start = 0x100000000,
++ .virt_start = 0x100000000,
++ .size = 0x100000000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_EXECUTE,
+ },
+--
+2.27.0
+
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse_git.bb b/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse_git.bb
index c17e5f48..2fbd68e3 100644
--- a/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse_git.bb
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/jailhouse_git.bb
@@ -13,7 +13,11 @@ LIC_FILES_CHKSUM = " \
SRCREV = "4ce7658dddfd5a1682a379d5ac46657e93fe1ff0"
PV = "0.12+git${SRCPV}"
-SRC_URI = "git://github.com/siemens/jailhouse"
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI = "git://github.com/siemens/jailhouse \
+ file://0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch \
+ "
DEPENDS = "virtual/kernel dtc-native python3-mako-native make-native"