summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--meta-agl-devel/meta-agl-jailhouse/recipes-platform/packagegroups/packagegroup-agl-jailhouse.bb14
-rw-r--r--meta-agl-jailhouse/meta-agl-jailhouse.md226
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-linux-x86-demo.c98
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c197
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-block.bb54
-rw-r--r--meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-console.bb54
-rw-r--r--templates/feature/agl-jailhouse/50_local.conf.inc3
7 files changed, 619 insertions, 27 deletions
diff --git a/meta-agl-devel/meta-agl-jailhouse/recipes-platform/packagegroups/packagegroup-agl-jailhouse.bb b/meta-agl-devel/meta-agl-jailhouse/recipes-platform/packagegroups/packagegroup-agl-jailhouse.bb
new file mode 100644
index 00000000..5fe7bd65
--- /dev/null
+++ b/meta-agl-devel/meta-agl-jailhouse/recipes-platform/packagegroups/packagegroup-agl-jailhouse.bb
@@ -0,0 +1,14 @@
+SUMMARY = "Virtio over IVSHMEM"
+DESCRIPTION = "The set of modules required to use virtio over IVSHMEM applications in AGL"
+LICENSE = "MIT"
+
+inherit packagegroup
+
+PACKAGES = "\
+ packagegroup-agl-jailhouse \
+"
+
+RDEPENDS:packagegroup-agl-jailhouse = "\
+ virtio-ivshmem-block \
+ virtio-ivshmem-console \
+" \ No newline at end of file
diff --git a/meta-agl-jailhouse/meta-agl-jailhouse.md b/meta-agl-jailhouse/meta-agl-jailhouse.md
new file mode 100644
index 00000000..8108efae
--- /dev/null
+++ b/meta-agl-jailhouse/meta-agl-jailhouse.md
@@ -0,0 +1,226 @@
+## Jailhouse support layer
+
+
+Yocto layer that enables the use of the Jailhouse partitioning hypervisor - <https://github.com/siemens/jailhouse>.
+
+### How to Enable and Use
+
+### For QEmu x86_64
+
+> Note: Right now the below setup is only working for Intel Machines.
+
+The AGL feature `agl-jailhouse` has to be enabled. That needs to be done when including aglsetup.sh, for example:
+
+```sh
+$ source meta-agl/scripts/aglsetup.sh -m qemux86-64 -b build agl-devel agl-jailhouse
+```
+
+That will enable this layer and include the `jailhouse` package in the image.
+
+
+Then, in the target system, the cell configurations (*.cell) are placed in `/usr/share/jailhouse/cells/` and the demo inmates (bare-metal applications to run in a non-root cell) are located in `/usr/share/jailhouse/inmates`.
+
+
+After that follow the [AGL-Documentation](https://docs.automotivelinux.org/en/master/#0_Getting_Started/2_Building_AGL_Image/2_Downloading_AGL_Software/) as usual and build the image using `bitbake core-image-minimal`.
+
+
+After successfully building the image we need to QEmulate the Image using `runqemu`:
+
+
+```sh
+
+$ runqemu qemux86-64 slirp kvm publicvnc serial bootparams="verbose ipv6.disable=1 intel_iommu=off"
+
+```
+
+After successful emulation of the Image, you will see something similar to this:
+
+
+```sh
+
+[ 0.021231] [Firmware Bug]: TSC_DEADLINE disabled due to Errata; please update microcode to version: 0xb2 (or later)
+
+[ 0.588075] kvm: already loaded the other module
+
+[ 0.926525] hdaudio hdaudioC0D0: Unable to bind the codec
+
+Automotive Grade Linux 11.91.0 qemux86-64 ttyS0
+
+qemux86-64 login: root
+
+```
+
+### For Running the Linux Cell
+
+
+In order to spin-up the Root cell and Inmates, you will need Cell Configurations (*.cell) and Inmates, which you will find at `/usr/share/jailhouse/cell` and `/usr/share/jailhouse/inmates`.
+
+
+But for Linux-Cell some preparation is needed and the things which you will require include:
+
+
+- `bzImage`
+
+- `rootfs.cpio`
+
+
+These files you can find easily in the `build/tmp/deploy/images/qemux86-64/`.
+
+After obtaining these files you have to `scp` these to the emulated Image.
+
+Now you should have everything in the target system and you can now spin up the things but before that check, if `jailhouse` is present or not:
+
+```sh
+
+qemux86-64:~# lsmod
+
+Module Size Used by
+
+jailhouse 36864 0
+
+```
+As you can see it’s showing present, In case if it’s not present then run `modprobe jailhouse`, it will load the Jailhouse kernel module.
+
+After loading the module now we have to enable the Jailhouse-Root-Cell, enable this by the below command:
+
+```sh
+
+qemux86-64:~# jailhouse enable /usr/share/jailhouse/cells/qemu-agl.cell
+
+```
+
+ And check the console for the logs.
+
+After loading jailhouse Root-cell, now we have to load the Non-root Linux cell, so for that run the below commands:
+
+
+```sh
+
+qemux86-64:~# jailhouse cell linux /usr/share/jailhouse/cells/agl-linux-x86-demo.cell bzImage -i rootfs.cpio -w out.file -c "console=ttyS2,115200 earlycon earlyprintk"
+
+```
+
+
+> Note: In the above command, when you add the `-w out.file` option then it will spit out some commands to start the non-root cell, if not then the cell will boot as usual. Those spitted out commands would look something like these below, you have to run it one by one:
+
+
+
+```sh
+
+qemux86-64:~# jailhouse cell create /usr/share/jailhouse/cells/agl-linux-x86-demo.cell
+
+qemux86-64:~# jailhouse cell load linux-x86-demo linux-loader.bin -a 0x0 bzImage -a 0xffc600 rootfs.cpio -a 0x3d89000 out.file -a 0x1000
+
+qemux86-64:~# jailhouse cell start linux-x86-demo.cell
+
+```
+
+> Note: As you can see in the spit-out commands there is a `linux-loader.bin` is present, this is a tiny bootloader that is required to boot the Linux-inmate or Linux-non-root cell. It is located in `/usr/libexec/jailhouse/linux-loader.bin` in the Emulated Image.
+
+After running the above commands you will see that Linux is booting in another console.
+
+Some helper scripts are present to automate all this, and it can be found [here](https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL/meta-agl-devel.git;a=tree;f=meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts).
+
+
+### For Testing Virtio over IVSHMEM Block
+
+You can test the Virtio-block over IVSHMEM by following the steps below:
+
+**This is for the Root-cell <---> Non-Root-Cell communication.**
+
+First, you have to boot the Image and enable the `qemu-agl.cell` into the target system, as described in the above sections.
+
+After that follow the below steps to get it spinning:
+
+```sh
+
+qemux86-64:~# jailhouse enable /usr/share/jailhouse/cells/qemu-agl.cell
+qemux86-64:~# modprobe uio_ivshmem
+
+```
+
+After this check for the PCI device using `lspci -k`, you will see something like this below:
+
+```sh
+
+qemux86-64:~# lspci -k
+
+.
+
+.
+
+.
+
+00:0c.0 Unassigned class [ff80]: Siemens AG Device 4106
+
+Subsystem: Siemens AG Device 4106
+
+.
+
+.
+
+.
+
+```
+
+After confirming, run the below command, this will create a virtio block backend
+
+```sh
+
+qemux86-64:~# echo "110a 4106 110a 4106 ffc002 ffffff" >
+
+/sys/bus/pci/drivers/uio_ivshmem/new_id
+
+```
+
+And after that, start the backend service like this:
+
+```sh
+
+qemux86-64:~# ./virtio-ivshmem-block /dev/uio0 disk.img
+
+Waiting for peer to be ready...
+
+```
+
+After running the backend-service boot or reboot another cell, and backend will show something like this:
+
+```sh
+
+qemux86-64:~ # ./virtio-ivshmem-block /dev/uio0 disk.img
+
+Waiting for peer to be ready...
+
+Starting virtio device
+
+device_status: 0x0
+
+device_status: 0x1
+
+device_status: 0x3
+
+device_features_sel: 1
+
+device_features_sel: 0
+
+.
+
+.
+
+.
+
+```
+
+In the Non-Root-Linux, the disk will show up as /dev/vda and can be accessed normally.
+
+
+>Note:
+>- For the `virtio-ivshmem-block` you can find it in target system at `/usr/bin/`, if not then copy it from here `build/tmp/work-shared/qemux86-64/kernel-source/tools/virtio/virtio-ivshmem-block`.
+>
+>- For the `disk.img`, It needs to be a raw image. But its size matters as that defines the virtual disk size, but you may even leave it empty and only partition or format it from the front-end guest.
+>
+> e.g:
+>
+> $ dd if=/dev/zero of=disk.img bs=1M count=1024
+>
+> $ mkfs.ext4 disk.img
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,
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c b/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c
index d134e971..265b4997 100644
--- a/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c
@@ -39,16 +39,65 @@
* "memmap=0x5200000$0x22000000"
*/
+/* For extending 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 + DEMO_MEM + NET_MEM + CON_MEM)
+#define COMM_PCI_REGIONS (BLK_PCI + DEMO_PCI + NET_PCI + CON_PCI)
+
+
#include <jailhouse/types.h>
#include <jailhouse/cell-config.h>
struct {
struct jailhouse_system header;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[17];
+ struct jailhouse_memory mem_regions[17 + COMM_MEM_REGIONS];
struct jailhouse_irqchip irqchips[1];
- struct jailhouse_pio pio_regions[14];
- struct jailhouse_pci_device pci_devices[13];
+ struct jailhouse_pio pio_regions[15];
+ struct jailhouse_pci_device pci_devices[13 + COMM_PCI_REGIONS];
struct jailhouse_pci_capability pci_caps[14];
} __attribute__((packed)) config = {
.header = {
@@ -96,6 +145,81 @@ struct {
},
.mem_regions = {
+
+#if defined USE_VIRTIO_BLK
+ /* IVSHMEM shared memory region (virtio-blk back-end) */
+ {
+ .phys_start = 0x26e00000,
+ .virt_start = 0x26e00000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x26e01000,
+ .virt_start = 0x26e01000,
+ .size = 0xdf000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+ },
+ { 0 },
+ { 0 },
+#endif
+#if defined(USE_VIRTIO_CON)
+ /* IVSHMEM shared memory region (virtio-con back-end) */
+ {
+ .phys_start = 0x220e0000,
+ .virt_start = 0x220e0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ,
+ },
+ {
+ .phys_start = 0x220e1000,
+ .virt_start = 0x220e1000,
+ .size = 0xf000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+ },
+ { 0 },
+ { 0 },
+#endif
+#if defined USE_IVSHMEM_DMEO
+ /* IVSHMEM shared memory regions (demo) */
+ {
+ .phys_start = 0x220f0000,
+ .virt_start = 0x220f0000,
+ .size = 0x1000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x220f1000,
+ .virt_start = 0x220f1000,
+ .size = 0x9000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+ JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x220fa000,
+ .virt_start = 0x220fa000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x220fc000,
+ .virt_start = 0x220fc000,
+ .size = 0x2000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
+ },
+ {
+ .phys_start = 0x220fe000,
+ .virt_start = 0x220fe000,
+ .size = 0x2000,
+ .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, 0),
+#endif
+
/* MemRegion: 00000000-0009fbff : System RAM */
{
.phys_start = 0x0,
@@ -126,11 +250,11 @@ struct {
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
- /* MemRegion: 27200000-7ffd7fff : System RAM */
+ /* MemRegion: 27200000-3ffd7fff : System RAM */
{
.phys_start = 0x27200000,
.virt_start = 0x27200000,
- .size = 0x58dd8000,
+ .size = 0x18dd8000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
},
@@ -258,10 +382,9 @@ struct {
PIO_RANGE(0x2f8, 0x8),
/* Port I/O: 03c0-03df : vga+ */
PIO_RANGE(0x3c0, 0x20),
- /* Port I/O: 03e8-03ef : serial */
- /* PIO_RANGE(0x3e8, 0x8), */
/* Port I/O: 03f8-03ff : serial */
PIO_RANGE(0x3f8, 0x8),
+ PIO_RANGE(0x3e8, 0x8),
/* Port I/O: 0510-051b : QEMU0002:00 */
/* PIO_RANGE(0x510, 0xc), */
/* Port I/O: 0600-0603 : ACPI PM1a_EVT_BLK */
@@ -538,6 +661,64 @@ struct {
.msix_region_size = 0x0,
.msix_address = 0x0,
},
+#if defined USE_VIRTIO_BLK
+ { /* IVSHMEM (virtio-blk back-end) */
+ .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+ .iommu = 1,
+ .domain = 0x0,
+ .bdf = 0x0c << 3,
+ .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
+ .num_msix_vectors = 2,
+ .shmem_regions_start = 0,
+ .shmem_dev_id = 0,
+ .shmem_peers = 2,
+ .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_BACK +
+ VIRTIO_DEV_BLOCK,
+ },
+#endif
+#if defined USE_VIRTIO_CON
+ { /* IVSHMEM (virtio-con back-end) */
+ .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+ .iommu = 1,
+ .domain = 0x0,
+ .bdf = 0x0d << 3,
+ .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
+ .num_msix_vectors = 3,
+ .shmem_regions_start = BLK_MEM, /* 0 + BLK_MEM */
+ .shmem_dev_id = 0,
+ .shmem_peers = 2,
+ .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_BACK +
+ VIRTIO_DEV_CONSOLE,
+ },
+#endif
+#if defined USE_IVSHMEM_DEMO
+ { /* IVSHMEM (demo) */
+ .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+ .iommu = 1,
+ .domain = 0x0,
+ .bdf = 0x0e << 3,
+ .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
+ .num_msix_vectors = 16,
+ .shmem_regions_start = BLK_MEM + CON_MEM,
+ .shmem_dev_id = 0,
+ .shmem_peers = 3,
+ .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
+ },
+#endif
+#if defined USE_VIRTIO_NET
+ { /* IVSHMEM (Networking) */
+ .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
+ .iommu = 1,
+ .domain = 0x0,
+ .bdf = 0x0f << 3,
+ .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
+ .num_msix_vectors = 2,
+ .shmem_regions_start = BLK_MEM + CON_MEM + DEMO_MEM,
+ .shmem_dev_id = 0,
+ .shmem_peers = 2,
+ .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
+ },
+#endif
},
.pci_caps = {
@@ -632,4 +813,4 @@ struct {
.flags = 0,
},
},
-};
+}; \ No newline at end of file
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-block.bb b/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-block.bb
new file mode 100644
index 00000000..4ee6c98a
--- /dev/null
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-block.bb
@@ -0,0 +1,54 @@
+SUMMARY = "virtio-ivshmem-block built out of the kernel tree"
+DESCRIPTION = "virtio-ivshmem-block built out of the kernel tree."
+HOMEPAGE = "https://kernel.org"
+
+LICENSE = "GPLv2"
+
+PR = "r1"
+
+DEPENDS = " \
+ virtual/${MLPREFIX}libc \
+ ${MLPREFIX}elfutils \
+ ${MLPREFIX}binutils \
+ bison-native flex-native xz \
+"
+
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+PROVIDES = "virtual/virtio-ivshmem-block"
+
+inherit linux-kernel-base kernel-arch
+
+#kernel 3.1+ supports WERROR to disable warnings as errors
+export WERROR = "0"
+
+do_populate_lic[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit kernelsrc
+
+
+#PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+S = "${WORKDIR}"
+
+RDEPENDS:${PN}-dev = ""
+
+EXTRA_OEMAKE = " CC="${CC} ${CFLAGS} ${LDFLAGS}" CPP="${CPP}""
+
+do_configure() {
+ echo "configure"
+}
+
+do_compile() {
+
+ oe_runmake CC="${CC} -I${STAGING_DIR_TARGET}/usr/include/ " LD="${LD}" AR="${AR}" \
+ -C ${STAGING_KERNEL_DIR}/tools/virtio/ O=${S} virtio-ivshmem-block
+
+}
+
+do_install(){
+
+ install -d ${D}${bindir}/
+ install -m 0755 ${STAGING_KERNEL_DIR}/tools/virtio/virtio-ivshmem-block ${D}${bindir}
+
+} \ No newline at end of file
diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-console.bb b/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-console.bb
new file mode 100644
index 00000000..3d046f14
--- /dev/null
+++ b/meta-agl-jailhouse/recipes-extended/jailhouse/virtio-ivshmem-console.bb
@@ -0,0 +1,54 @@
+SUMMARY = "virtio-ivshmem-console built out of the kernel tree"
+DESCRIPTION = "virtio-ivshmem-console built out of the kernel tree."
+HOMEPAGE = "https://kernel.org"
+
+LICENSE = "GPLv2"
+
+PR = "r1"
+
+DEPENDS = " \
+ virtual/${MLPREFIX}libc \
+ ${MLPREFIX}elfutils \
+ ${MLPREFIX}binutils \
+ bison-native flex-native xz \
+"
+
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+PROVIDES = "virtual/virtio-ivshmem-console"
+
+inherit linux-kernel-base kernel-arch
+
+#kernel 3.1+ supports WERROR to disable warnings as errors
+export WERROR = "0"
+
+do_populate_lic[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit kernelsrc
+
+
+#PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+S = "${WORKDIR}"
+
+RDEPENDS:${PN}-dev = ""
+
+EXTRA_OEMAKE = " CC="${CC} ${CFLAGS} ${LDFLAGS}" CPP="${CPP}""
+
+do_configure() {
+ echo "configure"
+}
+
+do_compile() {
+
+ oe_runmake CC="${CC} -I${STAGING_DIR_TARGET}/usr/include/ " LD="${LD}" AR="${AR}" \
+ -C ${STAGING_KERNEL_DIR}/tools/virtio/ O=${S} virtio-ivshmem-console
+
+}
+
+do_install(){
+
+ install -d ${D}${bindir}/
+ install -m 0755 ${STAGING_KERNEL_DIR}/tools/virtio/virtio-ivshmem-console ${D}${bindir}
+
+} \ No newline at end of file
diff --git a/templates/feature/agl-jailhouse/50_local.conf.inc b/templates/feature/agl-jailhouse/50_local.conf.inc
index 4b5e42f4..9a320c31 100644
--- a/templates/feature/agl-jailhouse/50_local.conf.inc
+++ b/templates/feature/agl-jailhouse/50_local.conf.inc
@@ -31,6 +31,9 @@ MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules"
# For a custom jailhouse kernel from git.kiszka.org
PREFERRED_PROVIDER_virtual/kernel = "linux-jailhouse-custom"
+# Add virtio-ivshmem-binaries to the QEmulated system
+IMAGE_INSTALL:append = " packagegroup-agl-jailhouse"
+
# prevent most external kernel module from being built
MOST_DRIVERS = ""
LTTNGUST:forcevariable := ""