Hej Mustafa :)

Can you share the cell and dts with me, from your GPIO transfer to the 
baremetal cell?
Are you working with the raspberry-pi/bcm2711 as well?

The serial driver already is loaded, so I would expect this to work, but I 
get some bus error, even the cell grants access to this address:
*[    0.035905] OF: amba: of_address_to_resource() failed (-22) for 
/serial@7e201600*

The I2C drivers are also loaded and two internal I2C are running on the 
base linux/the root cell. So I guess my defconfig should be ok?!
But the kernel logs give some phandle error, I find no helpful information 
about online...
*[    0.037665] OF: /i2c@7e804000: could not find phandle*

Yesterday I tried to transfer the GPIO as well. I oriented myself on this 
dts[1]
Leading to this cell and dts additions, which is the 283x-dtsi with the 
overriden values from the 2711.dts applied:

[image: dts.png]
Originally I started with the reg size of 0xb4 like in the rpi4 dts file, 
but booting the linux cell then gave me:


*[    0.195071] pinctrl-bcm2835 7e200000000000ff.gpio: could not get IO 
memory[    0.195095] pinctrl-bcm2835: probe of 7e200000000000b4.gpio failed 
with error -22*
In the kernel logs. So I increased it a little, since in the peripheral 
docs section 5.2[3] upto 0xf0 registers are mentioned, but the same error 
ocurrs
with reg-size of 0xff. I also do not understand, why the 32-bit address is 
expended to 64-bit, when the bcm2711 has a 35-bit bus...

And yes, I am using jailhouse-images. For building jailhouse myself - 
I tried that -  but I could'n start the kernel module with my self build 
image, 
but I am fine for now by working with the reference jailhouse-images.
If anybody has used peripherals in the linux demo in the rpi 
jailhouse-image I would be happy for any code references, or hints ^^

I don't know. Maybe my kernel hacking level is not up for using jailhouse 
like that. I fell that I struggle with the kernel here more, then with 
actual jailhouse.
But on the other hand I would like to understand, make it running, and add 
some practical examples of peripheral usage to some kind of docs, so
that the learning curve for getting started is a little less step. I just 
don't know where else to ask, if one can recommend some literature  to read 
or forum, where my
issues are discussed more adequately I am grateful for any hints :)

Thank you all very much!
Greetings Paul

[1] 
https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/bcm283x.dtsi#L107
[2] root@demo:~# jailhouse cell linux /etc/jailhouse/rpi4-linux-demo.cell   
                      /boot/vmlinux*                         -d 
/etc/jailhouse/dts/inmate-rpi4.dtb                         -i 
/usr/libexec/jailhouse/demos/rootfs.cpio                         -c 
"console=ttyS0,115200 ip=192.168.19.2"^C
root@demo:~# jailhouse cell linux 
/root/jailhouse-next/configs/arm64/rpi4-linux-demo_neu.cell /boot/vmlinux* 
-d /root/jailhouse-next/configs/arm64/dts/inmate-rpi4_custom.dtb -i 
/usr/libexec/jailhouse/demos/rootfs.cpio -c "console=ttyS0,115200 
ip=192.168.19.2"
root@demo:~# ssh 192.168.19.2
# dmesg | grep gpio
[    0.195071] pinctrl-bcm2835 7e200000000000ff.gpio: could not get IO 
memory
[    0.195095] pinctrl-bcm2835: probe of 7e200000000000ff.gpio failed with 
error -22
[3] https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf
[email protected] schrieb am Sonntag, 30. Januar 2022 um 20:04:57 UTC+1:

> 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/69269fdd-f93d-49b5-8b38-94090561dd48n%40googlegroups.com.

Reply via email to