From: Peng Fan <[email protected]>

After root cell start up, use following steps to start zephyr inmate:
jailhouse cell create qemu-arm64-zephyr-demo.cell
jailhouse cell load zephyr.bin -a 0x70000000
jailhouse cell start

Currently ivshmem not supported.

Signed-off-by: Peng Fan <[email protected]>
---

V1:
 Just a copy of linux inmate cell with minor update for zephyr usage.
 zephyr ivshmem-v2 is not supported for now, but I not remove that from
 cell file.
 Zephyr PR: https://github.com/zephyrproject-rtos/zephyr/pull/43301

 configs/arm64/qemu-arm64-zephyr-demo.c | 155 +++++++++++++++++++++++++
 1 file changed, 155 insertions(+)
 create mode 100644 configs/arm64/qemu-arm64-zephyr-demo.c

diff --git a/configs/arm64/qemu-arm64-zephyr-demo.c 
b/configs/arm64/qemu-arm64-zephyr-demo.c
new file mode 100644
index 00000000..e5e36237
--- /dev/null
+++ b/configs/arm64/qemu-arm64-zephyr-demo.c
@@ -0,0 +1,155 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Configuration for zephyr-demo inmate on QEMU arm64:
+ * 2 CPUs, 128M RAM, serial port
+ *
+ * Copyright (c) Siemens AG, 2014-2017
+ * Copyright 2022 NXP
+ *
+ * Authors:
+ *  Jan Kiszka <[email protected]>
+ *  Peng Fan <[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[1];
+       struct jailhouse_pci_device pci_devices[2];
+} __attribute__((packed)) config = {
+       .cell = {
+               .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
+               .revision = JAILHOUSE_CONFIG_REVISION,
+               .name = "qemu-arm64-zephyr-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 = 140-32,
+               .cpu_reset_address = 0x70000000,
+
+               .console = {
+                       .address = 0x09000000,
+                       .type = JAILHOUSE_CON_TYPE_PL011,
+                       .flags = JAILHOUSE_CON_ACCESS_MMIO |
+                                JAILHOUSE_CON_REGDIST_4,
+               },
+       },
+
+       .cpus = {
+               0x3,
+       },
+
+       .mem_regions = {
+               /* IVSHMEM shared memory regions (demo) */
+               {
+                       .phys_start = 0x7faf0000,
+                       .virt_start = 0x7faf0000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0x7faf1000,
+                       .virt_start = 0x7faf1000,
+                       .size = 0x9000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0x7fafa000,
+                       .virt_start = 0x7fafa000,
+                       .size = 0x2000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0x7fafc000,
+                       .virt_start = 0x7fafc000,
+                       .size = 0x2000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               {
+                       .phys_start = 0x7fafe000,
+                       .virt_start = 0x7fafe000,
+                       .size = 0x2000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_ROOTSHARED,
+               },
+               /* IVSHMEM shared memory region */
+               JAILHOUSE_SHMEM_NET_REGIONS(0x7fb00000, 1),
+               /* UART */ {
+                       .phys_start = 0x09000000,
+                       .virt_start = 0x09000000,
+                       .size = 0x1000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_IO | JAILHOUSE_MEM_ROOTSHARED,
+               },
+               /* RAM */ {
+                       .phys_start = 0x7f900000,
+                       .virt_start = 0,
+                       .size = 0x10000,
+                       .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+                               JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
+               },
+               /* RAM */ {
+                       .phys_start = 0x70000000,
+                       .virt_start = 0x70000000,
+                       .size = 0x8000000,
+                       .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 = 0x08000000,
+                       .pin_base = 32,
+                       .pin_bitmap = {
+                               1 << (33 - 32),
+                               0,
+                               0,
+                               (1 << (140 - 128)) | (1 << (141 - 128))
+                       },
+               },
+       },
+
+       .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,
+               },
+       },
+};
-- 
2.30.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/20220301080926.15295-1-peng.fan%40oss.nxp.com.

Reply via email to