From: Peng Fang <peng....@nxp.com> Signed-off-by: Peng Fang <peng....@nxp.com> Signed-off-by: Claudio Scordino <clau...@evidence.eu.com> --- configs/arm64/imx8mq-gic-demo.c | 56 ++++++++++++++++++++ configs/arm64/imx8mq.c | 108 +++++++++++++++++++++++++++++++++++++++ inmates/lib/arm64/include/mach.h | 12 +++++ 3 files changed, 176 insertions(+) create mode 100644 configs/arm64/imx8mq-gic-demo.c create mode 100644 configs/arm64/imx8mq.c
diff --git a/configs/arm64/imx8mq-gic-demo.c b/configs/arm64/imx8mq-gic-demo.c new file mode 100644 index 0000000..35a64eb --- /dev/null +++ b/configs/arm64/imx8mq-gic-demo.c @@ -0,0 +1,56 @@ +/* + * iMX8MQ target - gic-demo + * + * Copyright NXP 2018 + * + * Authors: + * Peng Fan <peng....@nxp.com> + * + * 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> + +#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) + +struct { + struct jailhouse_cell_desc cell; + __u64 cpus[1]; + struct jailhouse_memory mem_regions[2]; +} __attribute__((packed)) config = { + .cell = { + .signature = JAILHOUSE_CELL_DESC_SIGNATURE, + .revision = JAILHOUSE_CONFIG_REVISION, + .name = "gic-demo", + .flags = JAILHOUSE_CELL_PASSIVE_COMMREG, + + .cpu_set_size = sizeof(config.cpus), + .num_memory_regions = ARRAY_SIZE(config.mem_regions), + .num_irqchips = 0, + .pio_bitmap_size = 0, + .num_pci_devices = 0, + }, + + .cpus = { + 0x8, + }, + + .mem_regions = { + /* UART1 */ { + .phys_start = 0x30860000, + .virt_start = 0x30860000, + .size = 0x1000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_IO | JAILHOUSE_MEM_ROOTSHARED, + }, + /* RAM: Top at 4GB Space */ { + .phys_start = 0xffaf0000, + .virt_start = 0, + .size = 0x00010000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE, + }, + } +}; diff --git a/configs/arm64/imx8mq.c b/configs/arm64/imx8mq.c new file mode 100644 index 0000000..608e70b --- /dev/null +++ b/configs/arm64/imx8mq.c @@ -0,0 +1,108 @@ +/* + * i.MX8MQ Target + * + * Copyright 2017 NXP + * + * Authors: + * Peng Fan <peng....@nxp.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Reservation via device tree: reg = <0x0 0xffaf0000 0x0 0x510000> + */ + +#include <jailhouse/types.h> +#include <jailhouse/cell-config.h> + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) + +struct { + struct jailhouse_system header; + __u64 cpus[1]; + struct jailhouse_memory mem_regions[4]; + struct jailhouse_irqchip irqchips[3]; +} __attribute__((packed)) config = { + .header = { + .signature = JAILHOUSE_SYSTEM_SIGNATURE, + .revision = JAILHOUSE_CONFIG_REVISION, + .hypervisor_memory = { + .phys_start = 0xffc00000, + .size = 0x00400000, + }, + .debug_console = { + .address = 0x30860000, + .size = 0x1000, + .flags = JAILHOUSE_CON1_TYPE_IMX | + JAILHOUSE_CON1_ACCESS_MMIO | + JAILHOUSE_CON1_REGDIST_4 | + JAILHOUSE_CON2_TYPE_ROOTPAGE, + }, + .platform_info = { + .arm = { + .gic_version = 3, + .gicd_base = 0x38800000, + .gicr_base = 0x38880000, + .maintenance_irq = 25, + }, + }, + .root_cell = { + .name = "imx8mq", + + .cpu_set_size = sizeof(config.cpus), + .num_memory_regions = ARRAY_SIZE(config.mem_regions), + .num_irqchips = ARRAY_SIZE(config.irqchips), + }, + }, + + .cpus = { + 0xf, + }, + + .mem_regions = { + /* MMIO (permissive) */ { + .phys_start = 0x00000000, + .virt_start = 0x00000000, + .size = 0x40000000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_IO, + }, + /* RAM */ { + .phys_start = 0x40000000, + .virt_start = 0x40000000, + .size = 0xbfb00000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_EXECUTE, + }, + /* IVSHMEM shared memory region for 00:00.0 */ { + .phys_start = 0xffb00000, + .virt_start = 0xffb00000, + .size = 0x100000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, + }, + }, + + .irqchips = { + /* GIC */ { + .address = 0x38800000, + .pin_base = 32, + .pin_bitmap = { + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + }, + }, + /* GIC */ { + .address = 0x38800000, + .pin_base = 160, + .pin_bitmap = { + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + }, + }, + /* GIC */ { + .address = 0x38800000, + .pin_base = 288, + .pin_bitmap = { + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + }, + }, + }, +}; diff --git a/inmates/lib/arm64/include/mach.h b/inmates/lib/arm64/include/mach.h index 4d18929..478e32d 100644 --- a/inmates/lib/arm64/include/mach.h +++ b/inmates/lib/arm64/include/mach.h @@ -94,6 +94,18 @@ #define GICD_V3_BASE ((void *)0x08000000) #define GICR_V3_BASE ((void *)0x08100000) /* CPU 3 */ +#elif defined(CONFIG_MACH_IMX8MQ) +#define CON_TYPE "IMX-UART" +#define CON_BASE 0x30860000 + +#define GIC_VERSION 3 +#define GICD_V3_BASE ((void *)0x38800000) +/* + * Note: The GICR_V3_BASE address is core-specific. + * Address is 0x38880000 + x * 2 * 64K + */ +#define GICR_V3_BASE ((void *)0x388e0000) /* CPU 3 */ + #endif #ifndef TIMER_IRQ -- 2.7.4 -- 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 jailhouse-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.