On 01.07.21 10:49, Nikoleta Markela Iliakopoulou wrote:
> Dear all, 
> 
> I have jailhouse running on my rpi4 board (jailhouse-enabling/5.4-rpi
> kernel) and I want to boot a non-root linux cell. At first I tried with

Switch to jailhouse-enabling/5.10 - 5.4-rpi is dead, and 5.10 now nicely
works via upstream on the RPi4.

> the vmlinuz (5.10.31 )and the rootfs.cpio file produced with
> jailhouse-images ( I attach the config-5.10.31 , default-rootfs-config
> files ) and they seem to run fine. I wanted to customize my rootfs and
> put more packages, so I modified the config file and built it again with
> buildroot-2021.02.3. My rootfs.cpio file is about 210M (I attach the
> custom-config file ), so I tried to modify the memory reservations in
> the necessary files (jailhouse.dts , rpi4-linux-demo.c ).
> 
> *_rpi4-linux-demo.c
> _*
> /*
>  * Jailhouse, a Linux-based partitioning hypervisor
>  *
>  * Configuration for linux-demo inmate on Raspberry Pi 4:
>  * 2 CPUs, 128M RAM, serial port      // I just doubled it 
>  *
>  * Copyright (c) Siemens AG, 2014-2020
>  *
>  * Authors:
>  *  Jan Kiszka <[email protected] <mailto:[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[13];
> 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 = 0x2faf0000,
> .virt_start = 0x2faf0000,
> .size = 0x1000,
> .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
> },
> {
> .phys_start = 0x2faf1000,
> .virt_start = 0x2faf1000,
> .size = 0x9000,
> .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
> JAILHOUSE_MEM_ROOTSHARED,
> },
> {
> .phys_start = 0x2fafa000,
> .virt_start = 0x2fafa000,
> .size = 0x2000,
> .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
> },
> {
> .phys_start = 0x2fafc000,
> .virt_start = 0x2fafc000,
> .size = 0x2000,
> .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
> },
> {
> .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(0x2fb00000, 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,
> },
> /* RAM */ {
> .phys_start = 0x2f900000,
> .virt_start = 0,
> .size = 0x10000,
> .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
> JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
> },
> /* RAM */ {
> .phys_start = 0x18000000,
> .virt_start = 0x18000000,
> .size = 0x10000000,
> .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,
> },
> },
> };
> 
> *_jailhouse.dts
> _*
> /dts-v1/;
> /plugin/;
> / {
> compatible = "brcm,bcm2835";
> 
> fragment@0 {
> target-path = "/";
> __overlay__ {
> reserved-memory {
> #address-cells = <2>;
> #size-cells = <1>;
> ranges;
> 
> jailhouse@18000000 {
> reg = <0 0x18000000 0x18000000>;
> no-map;
> };
> };
> };
> };
> 
> fragment@1 {
> target = <&pcie0>;
> __overlay__ {
> linux,pci-domain = <0x00000000>;
> };
> };
> };
> 
> I adjusted them to be paged aligned. There seems no crashing as the cell
> starts, but the linux doesn't boot at all. I tried again with the
> modifications in memory and the old rootfs.cpio file , as well as with
> the vmlinuz only and they run fine, so I guess there is a problem with
> my new custom rootfs.cpio 
> 
> I'd be grateful if you provided me with some further guidance.
> 

Debugging this can be tedious as you likely already saw. The general
recommendation for starters therefore is to derive from the reference
image (jailhouse-images) and configuration (this is likely what you did
already), and then slowly adjust what you would like to do differently.

So, do you have a diff between your setting and jailhouse-images? The
above is not quickly to grasp and to manually diff for me.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
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/c4e3071d-cef7-fdec-10f0-255af63ead2e%40siemens.com.

Reply via email to