diff options
Diffstat (limited to 'meta-agl-jailhouse/recipes-extended/jailhouse/files')
7 files changed, 165 insertions, 76 deletions
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" + +<<DEMO + +qemux86-64:~# ./linux-non-root-cell.sh +Boot parameters written. Start Linux with the following commands (adjusting paths as needed): + +jailhouse cell create /usr/share/jailhouse/cells/agl-linux-x86-demo.cell +jailhouse cell load linux-x86-demo linux-loader.bin -a 0x0 bzImage -a 0xffc600 rootfs.cpio -a 0x3d89000 out.file -a 0x1000 +jailhouse cell start linux-x86-demo + +DEMO diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/run-qemu-jailhouse.sh b/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/run-qemu-jailhouse.sh new file mode 100755 index 00000000..c6688d1a --- /dev/null +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/helper-scripts/run-qemu-jailhouse.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "Running QEMU..." +runqemu qemux86-64 slirp kvm publicvnc serial bootparams="verbose ipv6.disable=1 intel_iommu=off" +echo "Powering Off..." + +# Note: If you want to run `$ jailhouse hardware check` then make `intel_iommu=on`, and `intel_iommu=off` for otherwise. 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 cf193c08..d134e971 100644 --- a/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/qemu-agl.c @@ -81,7 +81,7 @@ struct { }, }, .root_cell = { - .name = "RootCell", + .name = "AGL-Jailhouse-RootCell", .cpu_set_size = sizeof(config.cpus), .num_memory_regions = ARRAY_SIZE(config.mem_regions), .num_irqchips = ARRAY_SIZE(config.irqchips), @@ -104,35 +104,33 @@ struct { .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA, }, - /* MemRegion: 00100000-201fffff : System RAM */ + /* MemRegion: 000a0000-000bffff : PCI Bus 0000:00 */ { - .phys_start = 0x100000, - .virt_start = 0x100000, - .size = 0x20100000, - .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | - JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA, + .phys_start = 0xa0000, + .virt_start = 0xa0000, + .size = 0x20000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: 20200000-21ffffff : Kernel */ + /* MemRegion: 000f0000-000fffff : System ROM */ { - .phys_start = 0x20200000, - .virt_start = 0x20200000, - .size = 0x1e00000, - .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | - JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA, + .phys_start = 0xf0000, + .virt_start = 0xf0000, + .size = 0x10000, + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: 27200000-31ffffff : System RAM */ + /* MemRegion: 00100000-21ffffff : System RAM */ { - .phys_start = 0x27200000, - .virt_start = 0x27200000, - .size = 0xae00000, + .phys_start = 0x100000, + .virt_start = 0x100000, + .size = 0x21f00000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA, }, - /* MemRegion: 32000000-33ffffff : RAM buffer */ + /* MemRegion: 27200000-7ffd7fff : System RAM */ { - .phys_start = 0x32000000, - .virt_start = 0x32000000, - .size = 0x2000000, + .phys_start = 0x27200000, + .virt_start = 0x27200000, + .size = 0x58dd8000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA, }, @@ -178,7 +176,7 @@ struct { .size = 0x40000, .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, }, - /* MemRegion: febd0000-febd3fff : ICH HD audio */ + /* MemRegion: febd0000-febd3fff : 0000:00:1b.0 */ { .phys_start = 0xfebd0000, .virt_start = 0xfebd0000, @@ -246,8 +244,8 @@ struct { PIO_RANGE(0x60, 0x1), /* Port I/O: 0064-0064 : keyboard */ PIO_RANGE(0x64, 0x1), - /* Port I/O: 0070-0077 : rtc0 */ - PIO_RANGE(0x70, 0x8), + /* Port I/O: 0070-0071 : rtc0 */ + PIO_RANGE(0x70, 0x2), /* Port I/O: 0080-008f : dma page reg */ /* PIO_RANGE(0x80, 0x10), */ /* Port I/O: 00a0-00a1 : pic2 */ @@ -258,10 +256,10 @@ struct { /* PIO_RANGE(0xf0, 0x10), */ /* Port I/O: 02f8-02ff : serial */ PIO_RANGE(0x2f8, 0x8), - /* Port I/O: 0378-037a : parport0 */ - /* PIO_RANGE(0x378, 0x3), */ /* 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), /* Port I/O: 0510-051b : QEMU0002:00 */ diff --git a/meta-agl-jailhouse/recipes-extended/jailhouse/files/sample-inmates/agl-sample-inmate.tar.xz b/meta-agl-jailhouse/recipes-extended/jailhouse/files/sample-inmates/agl-sample-inmate.tar.xz Binary files differnew file mode 100644 index 00000000..21880674 --- /dev/null +++ b/meta-agl-jailhouse/recipes-extended/jailhouse/files/sample-inmates/agl-sample-inmate.tar.xz |