Hello everyone :) I am playing around with jailhouse finally for my thesis :)
I tried the last days to add another UART, I2C and some GPIOs to the non-root cell linux demo.
Already the UART produces some errors I cannot resolve myself. Maybe someone could hint me in the right direction ^^ I try to add uart3[1] and i2c1 from the BCM2711 to the non-root cell.Therefore I modified the reference dts[2] and linux-demo-cell[3] from the configs with these changes[4].
Then I re-make the jailhouse folder on the pi: root@demo:~/jailhouse-next# make KDIR=../linux-5.10.19/ CC /root/jailhouse-next/configs/arm64/rpi4-linux-demo_neu.o OBJCOPY /root/jailhouse-next/configs/arm64/rpi4-linux-demo_neu.cell DTC /root/jailhouse-next/configs/arm64/dts/inmate-rpi4_custom.dtb When booting up the kernel logs on serial line/dmsg show no difference. I hoped some of /dev/ttyS* devices now can be written to, but nope: # echo "hhhhhhh" > /dev/ttyS3 sh: write error: Input/output errorI dont know. Do my steps seem plausible, do I need something more to make these resources available in the non-root cell Linux besides adding the peripheral addresses to dts and the cell?
Any hints are very much apreciated ^^Attached are my custom cell source and dts file (or the patch file for the rpi4 linux-demo).
Thank you! PaulP.S. my kernel version of the jailhouse-images is 5.10.31, in the buildroot folder I only found 5.10.19 to re-build the .cell file, but I hope these 12 patches do not make for the error...
[1] https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/bcm2711.dtsi#L140 [2] https://github.com/siemens/jailhouse/blob/master/configs/arm64/dts/inmate-rpi4.dts [3] https://github.com/siemens/jailhouse/blob/master/configs/arm64/rpi4-linux-demo.c
[4] [p4w5@p4w5 jailhouse/configs]$ git diff .
diff --git a/configs/arm64/dts/inmate-rpi4.dts
b/configs/arm64/dts/inmate-rpi4.dts
index 305ac22f..8ff2da27 100644
--- a/configs/arm64/dts/inmate-rpi4.dts
+++ b/configs/arm64/dts/inmate-rpi4.dts
@@ -84,6 +84,27 @@
status = "okay";
};
+ uart3: serial@7e201600 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x7e201600 0x200>;
+ interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clocks BCM2835_CLOCK_UART>,
+ <&clocks BCM2835_CLOCK_VPU>;
+ clock-names = "uartclk", "apb_pclk";
+ arm,primecell-periphid = <0x00241011>;
+ status = "okay";
+ };
+
+ i2c1: i2c@7e804000 {
+ compatible = "brcm,bcm2835-i2c";
+ reg = <0x7e804000 0x1000>;
+ interrupts = <2 21>;
+ clocks = <&clocks BCM2835_CLOCK_VPU>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
pci@e0000000 {
compatible = "pci-host-ecam-generic";
device_type = "pci";
diff --git a/configs/arm64/rpi4-linux-demo.c b/configs/arm64/rpi4-linux-demo.c
index f93c564a..9ccdc9dd 100644
--- a/configs/arm64/rpi4-linux-demo.c
+++ b/configs/arm64/rpi4-linux-demo.c
@@ -19,7 +19,7 @@
struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[13];
+ struct jailhouse_memory mem_regions[15];
struct jailhouse_irqchip irqchips[2];
struct jailhouse_pci_device pci_devices[2];
} __attribute__((packed)) config = {
@@ -93,6 +93,22 @@ struct {
JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
},
+ /* UART3 */ {
+ .phys_start = 0x7e201600,
+ .virt_start = 0x7e201600,
+ .size = 0x200,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ /* I2C */ {
+ .phys_start = 0x7e804000,
+ .virt_start = 0x7e804000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
/* RAM */ {
.phys_start = 0x1f900000,
.virt_start = 0,
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/708f3b50-30ad-8ec8-d1a8-0ebd52f14586%40posteo.de.
diff --git a/configs/arm64/dts/inmate-rpi4.dts b/configs/arm64/dts/inmate-rpi4.dts
index 305ac22f..8ff2da27 100644
--- a/configs/arm64/dts/inmate-rpi4.dts
+++ b/configs/arm64/dts/inmate-rpi4.dts
@@ -84,6 +84,27 @@
status = "okay";
};
+ uart3: serial@7e201600 {
+ compatible = "arm,pl011", "arm,primecell";
+ reg = <0x7e201600 0x200>;
+ interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clocks BCM2835_CLOCK_UART>,
+ <&clocks BCM2835_CLOCK_VPU>;
+ clock-names = "uartclk", "apb_pclk";
+ arm,primecell-periphid = <0x00241011>;
+ status = "okay";
+ };
+
+ i2c1: i2c@7e804000 {
+ compatible = "brcm,bcm2835-i2c";
+ reg = <0x7e804000 0x1000>;
+ interrupts = <2 21>;
+ clocks = <&clocks BCM2835_CLOCK_VPU>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
pci@e0000000 {
compatible = "pci-host-ecam-generic";
device_type = "pci";
diff --git a/configs/arm64/rpi4-linux-demo.c b/configs/arm64/rpi4-linux-demo.c
index f93c564a..9ccdc9dd 100644
--- a/configs/arm64/rpi4-linux-demo.c
+++ b/configs/arm64/rpi4-linux-demo.c
@@ -19,7 +19,7 @@
struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[13];
+ struct jailhouse_memory mem_regions[15];
struct jailhouse_irqchip irqchips[2];
struct jailhouse_pci_device pci_devices[2];
} __attribute__((packed)) config = {
@@ -93,6 +93,22 @@ struct {
JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
},
+ /* UART3 */ {
+ .phys_start = 0x7e201600,
+ .virt_start = 0x7e201600,
+ .size = 0x200,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ /* I2C */ {
+ .phys_start = 0x7e804000,
+ .virt_start = 0x7e804000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 |
+ JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED,
+ },
/* RAM */ {
.phys_start = 0x1f900000,
.virt_start = 0,
/* * Jailhouse, a Linux-based partitioning hypervisor * * Configuration for linux-demo inmate on Raspberry Pi 4: * 2 CPUs, 128M RAM, serial port * * Copyright (c) Siemens AG, 2014-2020 * * Authors: * Jan Kiszka <[email protected]> * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory. */ #include <jailhouse/types.h> #include <jailhouse/cell-config.h> struct { struct jailhouse_cell_desc cell; __u64 cpus[1]; struct jailhouse_memory mem_regions[15]; struct jailhouse_irqchip irqchips[2]; struct jailhouse_pci_device pci_devices[2]; } __attribute__((packed)) config = { .cell = { .signature = JAILHOUSE_CELL_DESC_SIGNATURE, .revision = JAILHOUSE_CONFIG_REVISION, .name = "rpi4-linux-demo", .flags = JAILHOUSE_CELL_PASSIVE_COMMREG | JAILHOUSE_CELL_VIRTUAL_CONSOLE_PERMITTED, .cpu_set_size = sizeof(config.cpus), .num_memory_regions = ARRAY_SIZE(config.mem_regions), .num_irqchips = ARRAY_SIZE(config.irqchips), .num_pci_devices = ARRAY_SIZE(config.pci_devices), .vpci_irq_base = 185-32, .console = { .address = 0xfe215040, .type = JAILHOUSE_CON_TYPE_8250, .flags = JAILHOUSE_CON_ACCESS_MMIO | JAILHOUSE_CON_REGDIST_4, }, }, .cpus = { 0b1100, }, .mem_regions = { /* IVSHMEM shared memory regions (demo) */ { .phys_start = 0x1faf0000, .virt_start = 0x1faf0000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { .phys_start = 0x1faf1000, .virt_start = 0x1faf1000, .size = 0x9000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, { .phys_start = 0x1fafa000, .virt_start = 0x1fafa000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { .phys_start = 0x1fafc000, .virt_start = 0x1fafc000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { .phys_start = 0x1fafe000, .virt_start = 0x1fafe000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, /* IVSHMEM shared memory region */ JAILHOUSE_SHMEM_NET_REGIONS(0x1fb00000, 1), /* UART */ { .phys_start = 0xfe215040, .virt_start = 0xfe215040, .size = 0x40, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 | JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED, }, /* UART3 */ { .phys_start = 0x7e201600, .virt_start = 0x7e201600, .size = 0x200, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 | JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED, }, /* I2C */ { .phys_start = 0x7e804000, .virt_start = 0x7e804000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_8 | JAILHOUSE_MEM_IO_32 | JAILHOUSE_MEM_ROOTSHARED, }, /* RAM */ { .phys_start = 0x1f900000, .virt_start = 0, .size = 0x10000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE, }, /* RAM */ { .phys_start = 0x10000000, .virt_start = 0x10000000, .size = 0x8000000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE, }, /* communication region */ { .virt_start = 0x80000000, .size = 0x00001000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_COMM_REGION, }, }, .irqchips = { /* GIC */ { .address = 0xff841000, .pin_base = 32, .pin_bitmap = { 0, 0, 1 << (125 - 96), 0, }, }, /* GIC */ { .address = 0xff841000, .pin_base = 160, .pin_bitmap = { (1 << (185 - 160)) | (1 << (186 - 160)), 0, 0, 0 }, }, }, .pci_devices = { { /* IVSHMEM 00:00.0 (demo) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .domain = 1, .bdf = 0 << 3, .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, .shmem_regions_start = 0, .shmem_dev_id = 2, .shmem_peers = 3, .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED, }, { /* IVSHMEM 00:01.0 (networking) */ .type = JAILHOUSE_PCI_TYPE_IVSHMEM, .bdf = 1 << 3, .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, .shmem_regions_start = 5, .shmem_dev_id = 1, .shmem_peers = 2, .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH, }, }, };
inmate-rpi4_custom.dts
Description: audio/vnd.dts
