This adds the configs for inmate mach headers for the LeMaker HiKey board, 2GB edition. Configuration is rather permissive, should be fine-tuned later on.
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- configs/hikey-gic-demo.c | 55 +++++++++++++++ configs/hikey.c | 81 ++++++++++++++++++++++ inmates/lib/arm64/Makefile.lib | 1 + .../lib/arm64/include/mach-hi6220/mach/gic_v2.h | 14 ++++ inmates/lib/arm64/include/mach-hi6220/mach/timer.h | 13 ++++ inmates/lib/arm64/include/mach-hi6220/mach/uart.h | 13 ++++ 6 files changed, 177 insertions(+) create mode 100644 configs/hikey-gic-demo.c create mode 100644 configs/hikey.c create mode 100644 inmates/lib/arm64/include/mach-hi6220/mach/gic_v2.h create mode 100644 inmates/lib/arm64/include/mach-hi6220/mach/timer.h create mode 100644 inmates/lib/arm64/include/mach-hi6220/mach/uart.h diff --git a/configs/hikey-gic-demo.c b/configs/hikey-gic-demo.c new file mode 100644 index 0000000..d298087 --- /dev/null +++ b/configs/hikey-gic-demo.c @@ -0,0 +1,55 @@ +/* + * LeMaker HiKey board, 2 GB - gic-demo + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka <jan.kis...@siemens.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, + .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 = { + 0x10, + }, + + .mem_regions = { + /* UART */ { + .phys_start = 0xf7113000, + .virt_start = 0xf7113000, + .size = 0x1000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_IO | JAILHOUSE_MEM_ROOTSHARED, + }, + /* RAM */ { + .phys_start = 0x7bfe0000, + .virt_start = 0, + .size = 0x00010000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE, + }, + } +}; diff --git a/configs/hikey.c b/configs/hikey.c new file mode 100644 index 0000000..3c16c25 --- /dev/null +++ b/configs/hikey.c @@ -0,0 +1,81 @@ +/* + * LeMaker HiKey board, 2 GB + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka <jan.kis...@siemens.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_system header; + __u64 cpus[1]; + struct jailhouse_memory mem_regions[2]; + struct jailhouse_irqchip irqchips[1]; +} __attribute__((packed)) config = { + .header = { + .signature = JAILHOUSE_SYSTEM_SIGNATURE, + .hypervisor_memory = { + .phys_start = 0x7c000000, + .size = 0x04000000, + }, + .debug_console = { + .phys_start = 0xf7113000, + .size = 0x1000, + .flags = JAILHOUSE_MEM_IO, + }, + .platform_info.arm = { + .gicd_base = 0xf6801000, + .gicc_base = 0xf6802000, + .gich_base = 0xf6804000, + .gicv_base = 0xf6806000, + .maintenance_irq = 25, + }, + .root_cell = { + .name = "HiKey", + + .cpu_set_size = sizeof(config.cpus), + .num_memory_regions = ARRAY_SIZE(config.mem_regions), + .num_irqchips = ARRAY_SIZE(config.irqchips), + }, + }, + + .cpus = { + 0xff, + }, + + .mem_regions = { + /* MMIO (permissive) */ { + .phys_start = 0xf7000000, + .virt_start = 0xf7000000, + .size = 0x01100000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_IO, + }, + /* RAM + mailbox? (permissive) */ { + .phys_start = 0x0, + .virt_start = 0x0, + .size = 0x7c000000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | + JAILHOUSE_MEM_EXECUTE, + }, + }, + .irqchips = { + /* GIC */ { + .address = 0xf6801000, + .pin_base = 32, + .pin_bitmap = { + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + }, + }, + }, + +}; diff --git a/inmates/lib/arm64/Makefile.lib b/inmates/lib/arm64/Makefile.lib index 0196c51..1b787e8 100644 --- a/inmates/lib/arm64/Makefile.lib +++ b/inmates/lib/arm64/Makefile.lib @@ -29,6 +29,7 @@ endef mach-$(CONFIG_MACH_FOUNDATION_V8) := foundation-v8 mach-$(CONFIG_MACH_AMD_SEATTLE) := amd-seattle +mach-$(CONFIG_MACH_HI6220) := hi6220 MACHINE := mach-$(mach-y) KBUILD_CFLAGS += -I$(INMATES_LIB)/include/$(MACHINE) diff --git a/inmates/lib/arm64/include/mach-hi6220/mach/gic_v2.h b/inmates/lib/arm64/include/mach-hi6220/mach/gic_v2.h new file mode 100644 index 0000000..a8955d4 --- /dev/null +++ b/inmates/lib/arm64/include/mach-hi6220/mach/gic_v2.h @@ -0,0 +1,14 @@ +/* + * HiSilicon Hi6220 + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka <jan.kis...@siemens.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#define GICD_BASE ((void *)0xf6801000) +#define GICC_BASE ((void *)0xf6802000) diff --git a/inmates/lib/arm64/include/mach-hi6220/mach/timer.h b/inmates/lib/arm64/include/mach-hi6220/mach/timer.h new file mode 100644 index 0000000..6865d5b --- /dev/null +++ b/inmates/lib/arm64/include/mach-hi6220/mach/timer.h @@ -0,0 +1,13 @@ +/* + * HiSilicon Hi6220 + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka <jan.kis...@siemens.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#define TIMER_IRQ 27 diff --git a/inmates/lib/arm64/include/mach-hi6220/mach/uart.h b/inmates/lib/arm64/include/mach-hi6220/mach/uart.h new file mode 100644 index 0000000..4748168 --- /dev/null +++ b/inmates/lib/arm64/include/mach-hi6220/mach/uart.h @@ -0,0 +1,13 @@ +/* + * HiSilicon Hi6220 + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka <jan.kis...@siemens.com> + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#define UART_BASE ((void *)0xf7113000) -- 2.1.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.