From 4d9d7b0fc155fd9c30784ec2b1896796086ba575 Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 27 Jul 2021 22:15:00 +0200 Subject: meta-agl-jailhouse: Update the Jailhouse configuration files The current state and Information about the patch: - Updated Jailhouse root-cell(qemu-agl.c), apic-demo(agl-apic-demo.c), ivshmem-demo(agl-ivshmem-demo.c). - Jailhouse non-root cell(agl-linux-x86-demo.c) is also working, but need some more tweak for UART redirection. - Linux Kernel updated to the latest `queues/jailhouse` kernel branch. - Updated the `recipes-kernel` structure to a more custom one. - Updated conf/local.conf according to new `recipes-kernel` structure. - Removed the Linux Kernel patches from the `recipes-kernel` as updated kernel already contain those patches. This patch is the initial block for the virtio-blk support. v2 (Anmol): Add descriptive comments for serial in cell configuration files v3 (Anmol): Remove the ` IMAGE_INSTALL_append` and `EXTRA_IMAGE_FEATURES` from `50_local.conf.inc` v4 (Anmol): Minor changes in `50_local.conf.inc` v5 (jsmoeller): add meta-arm-toolchain to fix layer dependencies v6 (jsmoeller): remove linux-yocto_5.14%.bbappend v7 (Anmol): - Update the `SRCREV` for Jailhouse in `jailhous_git.bb` - Remove the patch `configs: arm64: Add support for RPi4 with more than 1G of memory` from `SRC_URI` in `jailhouse_git.bb` - Add the helper-scripts for the `runqemu-x86_64` and non-root linux cell. v8 (Anmol): Updated the `agl-ivshmem-demo.c`. v9 (Anmol): - Resolve build errors and update `jailhouse_git.bb`. - Add `PERF_forcevariable := "bash"` in `50_local.conf.inc`. v10 (Anmol): Disable perf build. v11 (jsmoeller): update qemu-agl.c to the 2G setup of runqemu after runtime test v12 (jsmoeller): add sample inmate tarball (to be used later) Change-Id: Idfa3e513488b5ecc8dfe9573f15c4b1c0edfd54f Signed-off-by: Anmol Signed-off-by: Jan-Simon Moeller --- .../jailhouse/files/agl-apic-demo.c | 14 +-- .../jailhouse/files/agl-ivshmem-demo.c | 32 +++--- .../jailhouse/files/agl-linux-x86-demo.c | 117 ++++++++++++++++----- .../files/helper-scripts/linux-non-root-cell.sh | 21 ++++ .../files/helper-scripts/run-qemu-jailhouse.sh | 7 ++ .../recipes-extended/jailhouse/files/qemu-agl.c | 50 +++++---- .../files/sample-inmates/agl-sample-inmate.tar.xz | Bin 0 -> 8587700 bytes .../recipes-extended/jailhouse/jailhouse_git.bb | 30 +++--- 8 files changed, 180 insertions(+), 91 deletions(-) create mode 100755 meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/linux-non-root-cell.sh create mode 100755 meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/run-qemu-jailhouse.sh create mode 100644 meta-agl-jailhouse/recipes-extended/jailhouse/files/sample-inmates/agl-sample-inmate.tar.xz (limited to 'meta-agl-jailhouse/recipes-extended') diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-apic-demo.c b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-apic-demo.c index f49cd3a4..40696d71 100644 --- a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-apic-demo.c +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-apic-demo.c @@ -20,7 +20,7 @@ struct { __u64 cpus[1]; struct jailhouse_memory mem_regions[2]; struct jailhouse_cache cache_regions[1]; - struct jailhouse_pio pio_regions[1];//[2]->[1] stop @0x3f8 + struct jailhouse_pio pio_regions[3]; } __attribute__((packed)) config = { .cell = { .signature = JAILHOUSE_CELL_DESC_SIGNATURE, @@ -38,7 +38,7 @@ struct { .console = { .type = JAILHOUSE_CON_TYPE_8250, .flags = JAILHOUSE_CON_ACCESS_PIO, - .address = 0x2f8, /* ######## ttyS0 is host -> ttyS1 */ + .address = 0x3e8, /* Serial 2: ttyS2(0x3e8) */ }, }, @@ -47,9 +47,9 @@ struct { }, .mem_regions = { - /* RAM */ { /* JH_memory: 0x22600000-0x271fffff */ - .phys_start = 0x26e00000 , /* agl-linux-x86: 0x22600000-0x26e00000 */ - .virt_start = 0, /* agl-ivshmem: 0x26e00000- (end of ivshmem cell) */ + /* RAM */ { + .phys_start = 0x22f00000, + .virt_start = 0, .size = 0x00100000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE, @@ -71,8 +71,8 @@ struct { }, .pio_regions = { - PIO_RANGE(0x2f8, 8), /* serial 2 */ -// PIO_RANGE(0x3f8, 8), /* serial 1 */ + PIO_RANGE(0x2e8, 8), /* serial 3: ttyS3(0x2e8) */ + PIO_RANGE(0x3e8, 8), /* serial 2: ttyS2(0x3e8) */ PIO_RANGE(0xe010, 8), /* OXPCIe952 serial */ }, }; diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-ivshmem-demo.c b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-ivshmem-demo.c index 79feb6c5..85dd5ebd 100644 --- a/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-ivshmem-demo.c +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/agl-ivshmem-demo.c @@ -20,14 +20,14 @@ struct { struct jailhouse_cell_desc cell; __u64 cpus[1]; struct jailhouse_memory mem_regions[7]; - struct jailhouse_pio pio_regions[1]; + struct jailhouse_pio pio_regions[2]; struct jailhouse_pci_device pci_devices[1]; struct jailhouse_pci_capability pci_caps[0]; } __attribute__((packed)) config = { .cell = { .signature = JAILHOUSE_CELL_DESC_SIGNATURE, .revision = JAILHOUSE_CONFIG_REVISION, - .name = "ivshmem-demo", + .name = "agl-ivshmem-demo", .flags = JAILHOUSE_CELL_PASSIVE_COMMREG | JAILHOUSE_CELL_VIRTUAL_CONSOLE_PERMITTED, @@ -41,7 +41,7 @@ struct { .console = { .type = JAILHOUSE_CON_TYPE_8250, .flags = JAILHOUSE_CON_ACCESS_PIO, - .address = 0x2f8,/* ######## ttyS0 is host -> ttyS1 */ + .address = 0x3e8, /* ######## ttyS2 is host -> ttyS3 */ }, }, @@ -52,39 +52,39 @@ struct { .mem_regions = { /* IVSHMEM shared memory regions (demo) */ { - .phys_start = 0x271f0000, - .virt_start = 0x271f0000, + .phys_start = 0x221f0000, + .virt_start = 0x221f0000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x271f1000, - .virt_start = 0x271f1000, + .phys_start = 0x221f1000, + .virt_start = 0x221f1000, .size = 0x9000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x271fa000, - .virt_start = 0x271fa000, + .phys_start = 0x221fa000, + .virt_start = 0x221fa000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x271fc000, - .virt_start = 0x271fc000, + .phys_start = 0x221fc000, + .virt_start = 0x221fc000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x271fe000, - .virt_start = 0x271fe000, + .phys_start = 0x221fe000, + .virt_start = 0x221fe000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, /* RAM */ { - .phys_start = 0x27200000,/* to 0x27300000 */ + .phys_start = 0x22f00000, .virt_start = 0, .size = 0x00100000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | @@ -99,8 +99,8 @@ struct { }, .pio_regions = { - PIO_RANGE(0x2f8, 8), /* serial 2 */ -// PIO_RANGE(0x3f8, 8), /* serial 1 */ + PIO_RANGE(0x2e8, 8), /* serial 3: ttyS3(0x2e8) */ + PIO_RANGE(0x3e8, 8), /* serial 2: ttyS2(0x3e8) */ }, .pci_devices = { 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 06085df5..4aa8db44 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 @@ -18,17 +18,25 @@ struct { struct jailhouse_cell_desc cell; __u64 cpus[1]; +#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT + struct jailhouse_memory mem_regions[24]; +#else struct jailhouse_memory mem_regions[20]; +#endif struct jailhouse_cache cache_regions[1]; struct jailhouse_irqchip irqchips[1]; - struct jailhouse_pio pio_regions[1]; + struct jailhouse_pio pio_regions[2]; +#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT + struct jailhouse_pci_device pci_devices[5]; +#else struct jailhouse_pci_device pci_devices[4]; +#endif struct jailhouse_pci_capability pci_caps[6]; } __attribute__((packed)) config = { .cell = { .signature = JAILHOUSE_CELL_DESC_SIGNATURE, .revision = JAILHOUSE_CONFIG_REVISION, - .name = "linux-x86-demo", + .name = "agl-linux-x86-demo", .flags = JAILHOUSE_CELL_PASSIVE_COMMREG | JAILHOUSE_CELL_VIRTUAL_CONSOLE_PERMITTED, @@ -46,16 +54,17 @@ struct { }, .mem_regions = { + /* IVSHMEM shared memory region (virtio-blk front) */ { - .phys_start = 0x27000000, /* to 0x27001000 */ - .virt_start = 0x27000000, + .phys_start = 0x22000000, + .virt_start = 0x22000000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x27001000,/* to 0x270e0000 */ - .virt_start = 0x27001000, + .phys_start = 0x22001000, + .virt_start = 0x22001000, .size = 0xdf000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, @@ -64,57 +73,58 @@ struct { { 0 }, /* IVSHMEM shared memory region (virtio-con front) */ { - .phys_start = 0x270e0000,/* to 0x270e1000 */ - .virt_start = 0x270e0000, + .phys_start = 0x220e0000, + .virt_start = 0x220e0000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x270e1000,/*to 0x270f0000 */ - .virt_start = 0x270e1000, + .phys_start = 0x220e1000, + .virt_start = 0x220e1000, .size = 0xf000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, { 0 }, { 0 }, + /* IVSHMEM shared memory regions (demo) */ { - .phys_start = 0x270f0000,/*to 0x270f1000 */ - .virt_start = 0x270f0000, + .phys_start = 0x220f0000, + .virt_start = 0x220f0000, .size = 0x1000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x270f1000,/*to 0x270fa000 */ - .virt_start = 0x270f1000, + .phys_start = 0x220f1000, + .virt_start = 0x220f1000, .size = 0x9000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x270fa000,/* to 0x270fc000 */ - .virt_start = 0x270fa000, + .phys_start = 0x220fa000, + .virt_start = 0x220fa000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x270fc000,/* to 0x270fe000*/ - .virt_start = 0x270fc000, + .phys_start = 0x220fc000, + .virt_start = 0x220fc000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED, }, { - .phys_start = 0x270fe000,/* to 0x27100000 */ - .virt_start = 0x270fe000, + .phys_start = 0x220fe000, + .virt_start = 0x220fe000, .size = 0x2000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_ROOTSHARED, }, /* IVSHMEM shared memory regions (networking) */ - JAILHOUSE_SHMEM_NET_REGIONS(0x27100000, 1), + JAILHOUSE_SHMEM_NET_REGIONS(0x22100000, 1), /* low RAM */ { - .phys_start = 0x22600000,/* to 0x22700000*/ + .phys_start = 0x22600000, .virt_start = 0, .size = 0x00100000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | @@ -122,20 +132,49 @@ struct { JAILHOUSE_MEM_LOADABLE, }, /* communication region */ { - /*.phys_start = ? */ .virt_start = 0x00100000, .size = 0x00001000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_COMM_REGION, }, /* high RAM */ { - .phys_start = 0x22700000,/*to 0x26e00000 */ + .phys_start = 0x22700000, .virt_start = 0x00200000, .size = 0x4700000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA | JAILHOUSE_MEM_LOADABLE, }, +#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT + /* MemRegion: feb40000-feb7ffff : 0000:00:02.0 */ + { + .phys_start = 0xfeb40000, + .virt_start = 0xfeb40000, + .size = 0x40000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, + }, + /* MemRegion: feb80000-feb9ffff : e1000e */ + { + .phys_start = 0xfeb80000, + .virt_start = 0xfeb80000, + .size = 0x20000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, + }, + /* MemRegion: feba0000-febbffff : e1000e */ + { + .phys_start = 0xfeba0000, + .virt_start = 0xfeba0000, + .size = 0x20000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, + }, + /* MemRegion: febd1000-febd3fff : e1000e */ + { + .phys_start = 0xfebd1000, + .virt_start = 0xfebd1000, + .size = 0x3000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, + }, +#endif }, .cache_regions = { @@ -157,9 +196,9 @@ struct { }, .pio_regions = { - PIO_RANGE(0x2f8, 8), /* serial 2 */ -// PIO_RANGE(0x3f8, 8), /* serial 1 */ - PIO_RANGE(0xe010, 8), /* OXPCIe952 serial1 */ + PIO_RANGE(0x2e8, 8), /* serial 2: ttyS3(0x2e8) */ + PIO_RANGE(0x3e8, 8), /* serial 1: ttyS2(0x3e8) */ +// PIO_RANGE(0xe010, 8), /* OXPCIe952 serial1 */ }, .pci_devices = { @@ -209,9 +248,33 @@ struct { .shmem_peers = 2, .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH, }, +#ifdef CONFIG_QEMU_E1000E_ASSIGNMENT + { /* e1000e */ + .type = JAILHOUSE_PCI_TYPE_DEVICE, + .domain = 0x0000, + .bdf = 0x0010, + .bar_mask = { + 0xfffe0000, 0xfffe0000, 0xffffffe0, + 0xffffc000, 0x00000000, 0x00000000, + }, + .caps_start = 0, + .num_caps = 6, + .num_msi_vectors = 1, + .msi_64bits = 1, + .num_msix_vectors = 5, + .msix_region_size = 0x1000, + .msix_address = 0xfebd0000, + }, +#endif }, .pci_caps = { + { /* e1000e */ + .id = PCI_CAP_ID_PM, + .start = 0xc8, + .len = 8, + .flags = JAILHOUSE_PCICAPS_WRITE, + }, { .id = PCI_CAP_ID_MSI, .start = 0xd0, diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/linux-non-root-cell.sh b/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/linux-non-root-cell.sh new file mode 100755 index 00000000..4915ed74 --- /dev/null +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/linux-non-root-cell.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# For Networking +dhclient enp0s2 + +# For Enabling the Root-Cell +jailhouse enable /usr/share/jailhouse/cells/qemu-agl.cell + +# For loading the Non-Root cell +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" + +<.c ${S}/configs/x86/ <--- folder where the cells are defined in the source tree to be compiled + #cp ${WORKDIR}/qemu-agl.c ${S}/configs/${JH_ARCH} cp ${WORKDIR}/agl-apic-demo.c ${S}/configs/x86/ - cp ${WORKDIR}/agl-pci-demo.c ${S}/configs/x86/ + # cp ${WORKDIR}/agl-pci-demo.c ${S}/configs/x86/ cp ${WORKDIR}/agl-linux-x86-demo.c ${S}/configs/x86/ cp ${WORKDIR}/agl-ivshmem-demo.c ${S}/configs/x86/ + cp ${WORKDIR}/qemu-agl.c ${S}/configs/x86/ sed -i '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' ${B}/tools/${BPN}-* } do_compile() { - oe_runmake + oe_runmake V=1 } do_install() { @@ -76,7 +74,6 @@ do_install() { install -d ${D}${INMATES_DIR} install -m 0644 ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR} - if [ ${JH_ARCH} != "x86" ]; then install -d ${D}${DTS_DIR} install -m 0644 ${B}/configs/${JH_ARCH}/dts/*.dtb ${D}${DTS_DIR} @@ -89,6 +86,9 @@ FILES_pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}" FILES_${PN}-tools = "${libexecdir}/${BPN}/${BPN}-* ${JH_DATADIR}/*.tmpl" FILES_${PN}-demos = "${JH_DATADIR}/ ${sbindir}/ivshmem-demo" +# Default Linker Hash Style Changed to "sysv" +TARGET_CC_ARCH += "${LDFLAGS}" + RDEPENDS_${PN}-tools = "pyjailhouse python3-mmap python3-math python3-datetime python3-curses python3-compression python3-mako" RDEPENDS_pyjailhouse = "python3-core python3-ctypes python3-fcntl" RDEPENDS_${PN}-demos = "jailhouse" -- cgit 1.2.3-korg