After revisiting some documentation/tutorial video I realized that there 
were significant misconceptions on my side.
I now placed the hypervisor memory outside of the linux memory defined in 
mem_regions and also added all regions used by the peripherals shown in 
/proc/iomem.

However, unfortunately the board still is stuck after enabling and there is 
no output (CONFIG_TRACE_ERROR is enabled).

#include <jailhouse/types.h>
#include <jailhouse/cell-config.h>

struct {
    struct jailhouse_system header;
    __u64 cpus[1];
    struct jailhouse_memory mem_regions[3];
    struct jailhouse_irqchip irqchips[1];
} __attribute__((packed)) config = {
    .header = {
        .signature = JAILHOUSE_SYSTEM_SIGNATURE,
        .revision = JAILHOUSE_CONFIG_REVISION,
        .flags = JAILHOUSE_SYS_VIRTUAL_DEBUG_CONSOLE,
        .hypervisor_memory = {
            .phys_start = 0x09000000,
            .size =       0x00400000,
        },
        .debug_console = {
            .flags = JAILHOUSE_CON_TYPE_NONE,
        },
        .platform_info = {
            .arm = {
                .gic_version = 2,
                .gicd_base = 0xffc01000,
                .gicc_base = 0xffc02000,
                .gich_base = 0xffc04000,
                .gicv_base = 0xffc06000,
                .maintenance_irq = 25,
            },
        },
        .root_cell = {
            .name = "a113x",
            .cpu_set_size = sizeof(config.cpus),
            .num_memory_regions = ARRAY_SIZE(config.mem_regions),
            .num_irqchips = ARRAY_SIZE(config.irqchips),
        },
    },

    .cpus = {
        0b1111,
    },

    .mem_regions = {
        {
                        .phys_start = 0xff3f0000,
                        .virt_start = 0xff3f0000,
                        .size = 0x419038,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_IO,
        },
        {
                        .phys_start = 0xffd13000,
                        .virt_start = 0xffd13000,
                        .size = 0x2C07FF,
                        .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                                JAILHOUSE_MEM_IO,
        },
        /* System RAM */ {
            .phys_start = 0x00000000,
            .virt_start = 0x00000000,
            .size = 0x08000000,
            .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                JAILHOUSE_MEM_EXECUTE,
        },
    },

    .irqchips = {
        /* GIC */ {
            .address = 0xffc01000,
            .pin_base = 32,
            .pin_bitmap = {
                0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
            },
        },
    },
};


lpfeifhofer schrieb am Donnerstag, 30. Juni 2022 um 14:42:20 UTC+2:

> Hi, I am currently trying to get jailhouse running on a new arm64 target 
> (Cortex-A53). I am trying to get a minimal root cell configuration working 
> but at the moment when enabling it it just immediately crashes the board 
> (stuck without any output).
>
> The physical memory on the board seems to be available from 
> 00000000-1fffffff (/proc/iomem) and initially I reduced the memory for 
> Linux using mem=128M to be able to place jailhouse into the upper regions 
> (see below, starting at 0x08000000).
>
> Following that I tried to make sense on how the GIC needs to be set up. 
> From what I know the device uses a GIC v2 with base address 0xffc01000. 
> This can be found in the linux device tree here: 
> https://github.com/khadas/linux/blob/khadas-vims-5.4.y/arch/arm64/boot/dts/amlogic/mesont7.dtsi#L285
>
> However, there it only features 2 entries, and in all v2 configurations 
> found in the jailhouse repo 4 addresses are used. (GIC v3 seems to use only 
> two).
>
> In addition I am not sure what the purpose of irqchips is and how that 
> should look like. Is this to communicate to jailhouse what interrupts it 
> can make use of?
>
> It would be great to get some feedback if I correctly configured the GIC 
> (and memory) and if what I am seeing could be related to a incorrect 
> configuration on my side. (I might also have to extend this configuration, 
> I assumed what I have is enough for a minimal setup.)
>
> struct {
>     struct jailhouse_system header;
>     __u64 cpus[1];
>     struct jailhouse_memory mem_regions[1];
>     struct jailhouse_irqchip irqchips[1];
>     struct jailhouse_pci_device pci_devices[0];
> } __attribute__((packed)) config = {
>     .header = {
>         .signature = JAILHOUSE_SYSTEM_SIGNATURE,
>         .revision = JAILHOUSE_CONFIG_REVISION,
>         .flags = JAILHOUSE_SYS_VIRTUAL_DEBUG_CONSOLE,
>         .hypervisor_memory = {
>             .phys_start = 0x08000000,
>             .size =       0x04000000,
>         },
>         .debug_console = {
>             .flags = JAILHOUSE_CON_TYPE_NONE,
>         },
>         .platform_info = {
>             .pci_mmconfig_base = 0x0C000000,
>             .pci_mmconfig_end_bus = 0,
>             .pci_is_virtual = 1,
>             .arm = {
>                 .gic_version = 2,
>                 .gicd_base = 0xffc01000,
>                 .gicc_base = 0xffc02000,
>                 .gich_base = 0xffc04000,
>                 .gicv_base = 0xffc06000,
>                 .maintenance_irq = 25,
>             },
>         },
>         .root_cell = {
>             .name = "AM113",
>
>             .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 = 108,
>         },
>     },
>
>     .cpus = {
>         0b1111,
>     },
>
>     .mem_regions = {
>         /* System RAM */ {
>             .phys_start = 0x08000000,
>             .virt_start = 0x08000000,
>             .size = 0x04000000,
>             .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
>                 JAILHOUSE_MEM_EXECUTE,
>         },
>     },
>
>     .irqchips = {
>         /* GIC */ {
>             .address = 0xffc01000,
>             .pin_base = 32,
>             .pin_bitmap = {
>                 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
>             },
>         },
>     },
>
>     .pci_devices = {
>
>     },
> };
>
>
> # cat /proc/iomem 
> 00000000-07ffffff : System RAM
>   03000000-03e3ffff : Kernel code
>   04030000-04bcbfff : Kernel data
> ff3f0000-ff3fffff : /ethernet@0xff3f0000
> ff500000-ff507fff : /dwc3@ff500000
>   ff500000-ff507fff : /dwc3@ff500000
> ff50c100-ff5fffff : /dwc3@ff500000
> ff634018-ff63401b : /rng
> ff634430-ff63446b : gpio
> ff634480-ff6344bf : mux
> ff6344e8-ff6344fb : pull
> ff634520-ff634533 : pull-enable
> ff634540-ff634547 : /ethernet@0xff3f0000
> ff63c400-ff63c44b : /mhu@c883c400
> ff642000-ff643fff : /soc/audiobus@0xff642000
> ff800014-ff80001b : mux
> ff800024-ff80002b : gpio
> ff80002c-ff80002f : pull
> ff803000-ff803017 : ff803000.serial
> ff805000-ff80501f : /soc/aobus@ff800000/i2c@5000
> ff809000-ff809037 : /saradc
> ffd13000-ffd1303b : /spi@ffd130000
> ffd1e000-ffd1e01f : /soc/cbus@ffd00000/i2c@1e000
> ffd23000-ffd23017 : ffd23000.serial
> ffe05000-ffe06fff : /sdio@ffe05000
> ffe07800-ffe079ff : ffe07800.mtd_nand
> ffe09000-ffe0907f : /usb2phy@ffe09000
> ffe09080-ffe0909f : /usb3phy@ffe09080
> fffd3000-fffd37ff : /mhu@c883c400
>
>
>

-- 
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/94f659ad-bfe9-4eda-8dfe-8d2296cea4e9n%40googlegroups.com.

Reply via email to