For demonstration purposes only. Signed-off-by: Ralf Ramsauer <ralf.ramsa...@oth-regensburg.de> --- configs/riscv/qemu-aplic-mc.c | 1 + configs/riscv/qemu-aplic-uc.c | 1 + configs/riscv/qemu-layout.h | 1 - configs/riscv/qemu-linux-demo-aplic.c | 1 + configs/riscv/qemu-linux-demo-plic.c | 1 + configs/riscv/qemu-linux-demo.h | 32 ++++++++++++++++++++++++++- configs/riscv/qemu-plic-mc.c | 1 + configs/riscv/qemu-plic-uc.c | 1 + configs/riscv/qemu.h | 32 ++++++++++++++++++++++++++- 9 files changed, 68 insertions(+), 3 deletions(-)
diff --git a/configs/riscv/qemu-aplic-mc.c b/configs/riscv/qemu-aplic-mc.c index 34c3bc9d..85077f00 100644 --- a/configs/riscv/qemu-aplic-mc.c +++ b/configs/riscv/qemu-aplic-mc.c @@ -1,3 +1,4 @@ #define QEMU_MC #define QEMU_APLIC +#define QEMU_IVSHMEM #include "qemu.h" diff --git a/configs/riscv/qemu-aplic-uc.c b/configs/riscv/qemu-aplic-uc.c index a26dcaa0..580cfe11 100644 --- a/configs/riscv/qemu-aplic-uc.c +++ b/configs/riscv/qemu-aplic-uc.c @@ -1,3 +1,4 @@ #define QEMU_UC #define QEMU_APLIC +#define QEMU_IVSHMEM #include "qemu.h" diff --git a/configs/riscv/qemu-layout.h b/configs/riscv/qemu-layout.h index 02e9ba51..6f9e6466 100644 --- a/configs/riscv/qemu-layout.h +++ b/configs/riscv/qemu-layout.h @@ -21,7 +21,6 @@ #define HV_OFFSET 0x200000 /* Recent OpenSBI place DTB there */ #define HV_PHYS (MEM_TOP - HV_OFFSET - HV_SIZE) -/* In preparation for IVSHMEM */ #define IVSHMEM_NET_PHYS (HV_PHYS - MIB) #define INMATE_TINY_SIZE MIB diff --git a/configs/riscv/qemu-linux-demo-aplic.c b/configs/riscv/qemu-linux-demo-aplic.c index 81442a13..f8711402 100644 --- a/configs/riscv/qemu-linux-demo-aplic.c +++ b/configs/riscv/qemu-linux-demo-aplic.c @@ -1,2 +1,3 @@ #define QEMU_APLIC +#define QEMU_IVSHMEM #include "qemu-linux-demo.h" diff --git a/configs/riscv/qemu-linux-demo-plic.c b/configs/riscv/qemu-linux-demo-plic.c index f4c0331a..608efff0 100644 --- a/configs/riscv/qemu-linux-demo-plic.c +++ b/configs/riscv/qemu-linux-demo-plic.c @@ -1,2 +1,3 @@ #define QEMU_PLIC +#define QEMU_IVSHMEM #include "qemu-linux-demo.h" diff --git a/configs/riscv/qemu-linux-demo.h b/configs/riscv/qemu-linux-demo.h index 68575dc6..12acc2fe 100644 --- a/configs/riscv/qemu-linux-demo.h +++ b/configs/riscv/qemu-linux-demo.h @@ -16,12 +16,26 @@ #include <jailhouse/cell-config.h> #include "qemu-layout.h" +#define MEM_REGIONS_BASE 4 + +#ifdef QEMU_IVSHMEM +#define IVSHMEM_REGIONS 4 +#else +#define IVSHMEM_REGIONS 0 +#endif + +#define MEM_REGIONS (MEM_REGIONS_BASE + IVSHMEM_REGIONS) + struct { struct jailhouse_cell_desc cell; struct jailhouse_cpu cpus[2]; - struct jailhouse_memory mem_regions[4]; + struct jailhouse_memory mem_regions[MEM_REGIONS]; struct jailhouse_irqchip irqchips[1]; +#ifdef QEMU_IVSHMEM + struct jailhouse_pci_device pci_devices[1]; +#else struct jailhouse_pci_device pci_devices[0]; +#endif } __attribute__((packed)) config = { .cell = { .signature = JAILHOUSE_CELL_DESC_SIGNATURE, @@ -57,6 +71,10 @@ struct { }, .mem_regions = { +#ifdef QEMU_IVSHMEM + /* IVSHMEM shared memory regions (networking) */ + JAILHOUSE_SHMEM_NET_REGIONS(IVSHMEM_NET_PHYS, 1), +#endif /* RAM low */ { .phys_start = INMATE_LINUX_LOW_PHYS, .virt_start = 0x0, @@ -87,6 +105,18 @@ struct { }, .pci_devices = { +#ifdef QEMU_IVSHMEM + { /* IVSHMEM (networking) */ + .type = JAILHOUSE_PCI_TYPE_IVSHMEM, + .domain = 0x0000, + .bdf = 0x10 << 3, + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, + .shmem_regions_start = 0, + .shmem_dev_id = 1, + .shmem_peers = 2, + .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH, + }, +#endif }, .irqchips = { diff --git a/configs/riscv/qemu-plic-mc.c b/configs/riscv/qemu-plic-mc.c index c29be90a..26c807d7 100644 --- a/configs/riscv/qemu-plic-mc.c +++ b/configs/riscv/qemu-plic-mc.c @@ -1,3 +1,4 @@ #define QEMU_MC #define QEMU_PLIC +#define QEMU_IVSHMEM #include "qemu.h" diff --git a/configs/riscv/qemu-plic-uc.c b/configs/riscv/qemu-plic-uc.c index f9842775..c6fa7339 100644 --- a/configs/riscv/qemu-plic-uc.c +++ b/configs/riscv/qemu-plic-uc.c @@ -1,3 +1,4 @@ #define QEMU_UC #define QEMU_PLIC +#define QEMU_IVSHMEM #include "qemu.h" diff --git a/configs/riscv/qemu.h b/configs/riscv/qemu.h index ceae015f..6f481769 100644 --- a/configs/riscv/qemu.h +++ b/configs/riscv/qemu.h @@ -21,6 +21,16 @@ #include <jailhouse/cell-config.h> #include "qemu-layout.h" +#define MEM_REGIONS_BASE 9 + +#ifdef QEMU_IVSHMEM +#define IVSHMEM_REGIONS 4 +#else +#define IVSHMEM_REGIONS 0 +#endif + +#define MEM_REGIONS (MEM_REGIONS_BASE + IVSHMEM_REGIONS) + struct { struct jailhouse_system header; #ifdef QEMU_UC @@ -28,9 +38,13 @@ struct { #elif defined(QEMU_MC) struct jailhouse_cpu cpus[6]; #endif - struct jailhouse_memory mem_regions[9]; + struct jailhouse_memory mem_regions[MEM_REGIONS]; struct jailhouse_irqchip irqchips[1]; +#ifdef QEMU_IVSHMEM + struct jailhouse_pci_device pci_devices[2]; +#else struct jailhouse_pci_device pci_devices[1]; +#endif struct jailhouse_pci_capability pci_caps[6]; } __attribute__((packed)) config = { .header = { @@ -114,6 +128,10 @@ struct { }, .mem_regions = { +#ifdef QEMU_IVSHMEM + /* IVSHMEM shared memory regions (networking) */ + JAILHOUSE_SHMEM_NET_REGIONS(IVSHMEM_NET_PHYS, 0), +#endif /* RAM */ { .phys_start = 0x80000000, .virt_start = 0x80000000, @@ -214,6 +232,18 @@ struct { .msix_region_size = 0x1000, .msix_address = 0x40080000, }, +#ifdef QEMU_IVSHMEM + { /* IVSHMEM (networking) */ + .type = JAILHOUSE_PCI_TYPE_IVSHMEM, + .domain = 0x0000, + .bdf = 0x10 << 3, + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, + .shmem_regions_start = 0, + .shmem_dev_id = 0, + .shmem_peers = 2, + .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH, + }, +#endif }, .pci_caps = { -- 2.40.1 -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20230519204033.643200-67-ralf.ramsauer%40oth-regensburg.de.