summaryrefslogtreecommitdiffstats
path: root/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c
diff options
context:
space:
mode:
authorAnmol <anmol.karan123@gmail.com>2021-08-21 00:39:46 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-08-30 12:14:03 +0000
commit042806431fafef0ce60ede76c66747e2ebe5d222 (patch)
tree3c2c070148f86d5eec617f0d3450b5cbd3e9036a /meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c
parent46b8ed7b8241ccd211048a91d16dcaf844558919 (diff)
[PATCH] meta-agl-jailhouse: Add support for virtio over IVSHMEM block
This patch adds the support for the virtio over IVSHMEM block for AGL with Jailhouse. Current state of the Patchset: - Add PCI devices from (00:0c.0 - 00:0f.0), for various virtio devices(virtio-ivshmem-{block, console, NET, custom}), primarily for virtio-blk. - Add Common memory regions for virtio-blk in the Root-Cell and Non-Root-Linux-Cell configurations. - Add Documentation `meta-agl-jailhouse.md` for usage and Instructions. - Add `virtio-ivshmem-block` and `virtio-ivshmem-console` recipes for ott Kernel modules. v2 (Anmol): Update `agl-linux-x86-demo.c` and `qemu-agl.c` for PCI macros and small descriptions for IVSHMEM PCI devices. V3 (Anmol): - [RFC] Add packagegroup for the virtio-ivshmem-{block, console} applications. - Update the `meta-agl-jailhouse.md` for architecture specific information. v4 (Anmol): Update recipe files according to the new syntax(3.4-honister). v5 (Anmol): - Update recipe files for virtio-ivshmem binaries. - Update `50_local.conf.inc` for `packagegroup-agl-jailhouse`. v5 (Anmol): Update syntax for `50_local.conf.inc`. Signed-off-by: Anmol <anmol.karan123@gmail.com> Change-Id: I1bed4c6f1d3d9b0792a18544ad18edca85a5f4f7
Diffstat (limited to 'meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c')
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c98
1 files changed, 79 insertions, 19 deletions
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c
index 4aa8db44..37fcf54c 100644
--- a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c
@@ -12,6 +12,52 @@
* the COPYING file in the top-level directory.
*/
+/* For extending the virtio-blk over IVSHMEM. */
+#define USE_VIRTIO_BLK
+
+/*
+ * Placeholder for extending virtio-device
+ *
+ * #define USE_VIRTIO_NET
+ * #define USE_VIRTIO_CON
+ * #define USE_VIRTIO_DEMO
+ */
+
+#ifdef USE_VIRTIO_BLK
+# define BLK_MEM 4
+# define BLK_PCI 1
+#else
+# define BLK_MEM 0
+# define BLK_PCI 0
+#endif
+
+#ifdef USE_IVSHMEM_DEMO
+# define DEMO_MEM 5
+# define DEMO_PCI 1
+#else
+# define DEMO_MEM 0
+# define DEMO_PCI 0
+#endif
+
+#ifdef USE_IVSHMEM_NET
+# define NET_MEM 4
+# define NET_PCI 1
+#else
+# define NET_MEM 0
+# define NET_PCI 0
+#endif
+
+#ifdef USE_VIRTIO_CON
+# define CON_MEM 4
+# define CON_PCI 1
+#else
+# define CON_MEM 0
+# define CON_PCI 0
+#endif
+
+#define COMM_MEM_REGIONS (BLK_MEM + CON_MEM + NET_MEM + DEMO_MEM)
+#define COMM_PCI_REGIONS (BLK_PCI + CON_PCI + NET_PCI + DEMO_PCI)
+
#include <jailhouse/types.h>
#include <jailhouse/cell-config.h>
@@ -19,17 +65,17 @@ struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT
- struct jailhouse_memory mem_regions[24];
+ struct jailhouse_memory mem_regions[7 + COMM_MEM_REGIONS];
#else
- struct jailhouse_memory mem_regions[20];
+ struct jailhouse_memory mem_regions[3 + COMM_MEM_REGIONS];
#endif
struct jailhouse_cache cache_regions[1];
struct jailhouse_irqchip irqchips[1];
struct jailhouse_pio pio_regions[2];
#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT
- struct jailhouse_pci_device pci_devices[5];
+ struct jailhouse_pci_device pci_devices[1 + COMM_PCI_REGIONS];
#else
- struct jailhouse_pci_device pci_devices[4];
+ struct jailhouse_pci_device pci_devices[COMM_PCI_REGIONS];
#endif
struct jailhouse_pci_capability pci_caps[6];
} __attribute__((packed)) config = {
@@ -54,24 +100,26 @@ struct {
},
.mem_regions = {
-
- /* IVSHMEM shared memory region (virtio-blk front) */
+#if defined USE_VIRTIO_BLK
+ /* IVSHMEM shared memory region (virtio-blk front-end) */
{
- .phys_start = 0x22000000,
- .virt_start = 0x22000000,
+ .phys_start = 0x26e00000,
+ .virt_start = 0x26e00000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
},
{
- .phys_start = 0x22001000,
- .virt_start = 0x22001000,
+ .phys_start = 0x26e01000,
+ .virt_start = 0x26e01000,
.size = 0xdf000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_ROOTSHARED,
},
{ 0 },
{ 0 },
- /* IVSHMEM shared memory region (virtio-con front) */
+#endif
+#if defined USE_IVSHMEM_CON
+ /* IVSHMEM shared memory region (virtio-con front-end) */
{
.phys_start = 0x220e0000,
.virt_start = 0x220e0000,
@@ -87,7 +135,8 @@ struct {
},
{ 0 },
{ 0 },
-
+#endif
+#if defined USE_IVSHMEM_DEMO
/* IVSHMEM shared memory regions (demo) */
{
.phys_start = 0x220f0000,
@@ -121,8 +170,11 @@ struct {
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_ROOTSHARED,
},
+#endif
+#if defined USE_IVSHMEM_NET
/* IVSHMEM shared memory regions (networking) */
JAILHOUSE_SHMEM_NET_REGIONS(0x22100000, 1),
+#endif
/* low RAM */ {
.phys_start = 0x22600000,
.virt_start = 0,
@@ -202,7 +254,8 @@ struct {
},
.pci_devices = {
- {
+#if defined USE_VIRTIO_BLK
+ { /* IVSHMEM (virtio-blk front-end) */
.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
.domain = 0x0,
.bdf = 0x0c << 3,
@@ -214,40 +267,47 @@ struct {
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
VIRTIO_DEV_BLOCK,
},
- {
+#endif
+#if defined USE_IVSHMEM_CON
+ { /* IVSHMEM (virtio-con front-end) */
.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
.domain = 0x0,
.bdf = 0x0d << 3,
.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
.num_msix_vectors = 3,
- .shmem_regions_start = 4,
+ .shmem_regions_start = BLK_MEM, /* 0 + BLK_MEM */
.shmem_dev_id = 1,
.shmem_peers = 2,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
VIRTIO_DEV_CONSOLE,
},
- {
+#endif
+#if defined USE_IVSHMEM_DEMO
+ { /* IVSHMEM (demo) */
.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
.domain = 0x0,
.bdf = 0x0e << 3,
.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
.num_msix_vectors = 16,
- .shmem_regions_start = 8,
+ .shmem_regions_start = BLK_MEM + CON_MEM,
.shmem_dev_id = 2,
.shmem_peers = 3,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
},
- {
+#endif
+#if defined USE_IVSHMEM_NET
+ { /* IVSHMEM (networking) */
.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
.domain = 0x0,
.bdf = 0x0f << 3,
.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
.num_msix_vectors = 2,
- .shmem_regions_start = 13,
+ .shmem_regions_start = BLK_MEM + CON_MEM + DEMO_MEM,
.shmem_dev_id = 1,
.shmem_peers = 2,
.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
},
+#endif
#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT
{ /* e1000e */
.type = JAILHOUSE_PCI_TYPE_DEVICE,