Hi, 
I am like, a student doing his thesis with Jailhouse. 
How did you built your non-root Linux cell, if you are taking the build 
root generated by jailhouse-images, you might need to add some flags in the 
buildroot defconfig. However, I am not sure. I did not try this with the 
Linux inmate, but I was able to add the GPIO on an bare-metal cell. So, I 
think your workflow is correct. It might be also possible, that your 
buildroot kernel does not have drivers for the nodes you added. One more 
question, are you using jailhouse-images, or you ported jailhouse yourself. 

Moustafa Noufale
On Sunday, 30 January 2022 at 19:48:13 UTC+1 Paul wrote:

> 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 error
>
> I 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!
> Paul
>
> P.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/3fd793cf-ddd7-4159-8ef2-2efbb525ec5fn%40googlegroups.com.

Reply via email to