qemu-system-x86_64 -machine q35 -m 1G -enable-kvm -smp 4 \
-cpu kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx,+x2apic \
-drive file=LinuxInstallation.img,id=disk,if=none \
- -device ide-hd,drive=disk -serial stdio -serial vc
+ -device ide-hd,drive=disk -serial stdio -serial vc \
+ -device intel-hda,addr=1b.0 -device hda-duplex
Inside the VM, make sure that jailhouse.bin, generated by the build process,
is available for firmware loading (typically /lib/firmware).
jailhouse cell load apic-demo /path/to/apic-demo.bin -a 0xf0000
jailhouse cell start apic-demo
-apic-demo.bin is left by the built process in the inmates/ directory. This
-application will program the APIC timer interrupt to fire at 10 Hz, measuring
-the jitter against the PM timer and displaying the result on the
+apic-demo.bin is left by the built process in the inmates/demos/x86 directory.
+This application will program the APIC timer interrupt to fire at 10 Hz,
+measuring the jitter against the PM timer and displaying the result on the
console. Given that this demonstration runs in a virtual machine, obviously
no decent latencies should be expected.
-To demonstrate the execution of a second, non-Linux cell, issue the following
-commands:
-
- jailhouse cell create /path/to/tiny-demo.cell
- jailhouse cell load tiny-demo /path/to/tiny-demo.bin -a 0xf0000
- jailhouse cell start tiny-demo
-
-The tiny-demo will use the second serial port provided by QEMU. You will find
-its output in a virtual console of the QEMU window.
-
After creation, cells are addressed via the command line tool by providing
their names or their runtime-assigned IDs. You can obtain information about
active cells this way:
apic-demo locks the hypervisor in this regard. In order to destroy another cell
or create an additional one, shut down the apic-demo first.
+ jailhouse cell shutdown apic-demo # call again if error is returned
+
+To demonstrate the execution of a second, non-Linux cell, issue the following
+commands:
+
+ jailhouse cell create /path/to/pci-demo.cell
+ jailhouse cell load pci-demo /path/to/pci-demo.bin -a 0xf0000
+ jailhouse cell start pci-demo
+
+The pci-demo will use the second serial port provided by QEMU. You will find
+its output in a virtual console of the QEMU window. The purpose of this demo is
+to show basic PCI device configuration and MSI handling.
+
While cell configurations are locked, it is still possible, though, to reload
the content of existing cell (provided they accept their shutdown first). To
reload and restart the tiny-demo, issue the following commands:
- jailhouse cell load tiny-demo /path/to/tiny-demo.bin -a 0xf0000
- jailhouse cell start tiny-demo
+ jailhouse cell start apic-demo
+ jailhouse cell load pci-demo /path/to/pci-demo.bin -a 0xf0000
+ jailhouse cell start pci-demo
Finally, Jailhouse is can be stopped completely again:
- jailhouse disable
+ jailhouse disable # call again on error due to running apic-demo
All non-Linux cells running at that point will be destroyed, and resources
will be returned to Linux.
struct {
struct jailhouse_system header;
__u64 cpus[1];
- struct jailhouse_memory mem_regions[9];
+ struct jailhouse_memory mem_regions[10];
struct jailhouse_irqchip irqchips[1];
__u8 pio_bitmap[0x2000];
- struct jailhouse_pci_device pci_devices[6];
- struct jailhouse_pci_capability pci_caps[3];
+ struct jailhouse_pci_device pci_devices[7];
+ struct jailhouse_pci_capability pci_caps[5];
} __attribute__((packed)) config = {
.header = {
.hypervisor_memory = {
.size = 0x10000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
- /* MemRegion: febf0000-febf0fff : 0000:00:01.0 */
+ /* MemRegion: febf0000-febf3fff : ICH HD audio */
{
.phys_start = 0xfebf0000,
.virt_start = 0xfebf0000,
+ .size = 0x4000,
+ .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
+ },
+ /* MemRegion: febf4000-febf4fff : 0000:00:01.0 */
+ {
+ .phys_start = 0xfebf4000,
+ .virt_start = 0xfebf4000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
- /* MemRegion: febf2000-febf2fff : ahci */
+ /* MemRegion: febf5000-febf5fff : ahci */
{
- .phys_start = 0xfebf2000,
- .virt_start = 0xfebf2000,
+ .phys_start = 0xfebf5000,
+ .virt_start = 0xfebf5000,
.size = 0x1000,
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
},
.domain = 0x0000,
.bdf = 0x0010,
},
- { /* virtio-9p-pci */
+ { /* ICH HD audio */
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.domain = 0x0000,
- .bdf = 0x0018,
+ .bdf = 0x00d8,
.caps_start = 0,
- .num_caps = 1,
- .num_msix_vectors = 2,
- .msix_region_size = 0x1000,
- .msix_address = 0xfebf1000,
+ .num_caps = 2,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
},
{ /* ISA bridge */
.type = JAILHOUSE_PCI_TYPE_DEVICE,
.domain = 0x0000,
.bdf = 0x00fb,
},
+ { /* virtio-9p-pci */
+ .type = JAILHOUSE_PCI_TYPE_DEVICE,
+ .domain = 0x0000,
+ .bdf = 0x00ff,
+ .caps_start = 4,
+ .num_caps = 1,
+ .num_msix_vectors = 2,
+ .msix_region_size = 0x1000,
+ .msix_address = 0xfebf6000,
+ },
},
.pci_caps = {
- { /* virtio-9p-pci */
- .id = 0x11,
+ { /* ICH HD audio */
+ .id = 0x5,
+ .start = 0x60,
+ .len = 14,
+ .flags = JAILHOUSE_PCICAPS_WRITE,
+ },
+ { /* non-cap registers: HDCTL, TCSEL, DCKCTL, DCKSTS */
.start = 0x40,
- .len = 12,
+ .len = 0x10,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
{ /* AHCI */
.len = 14,
.flags = JAILHOUSE_PCICAPS_WRITE,
},
+ { /* virtio-9p-pci */
+ .id = 0x11,
+ .start = 0x40,
+ .len = 12,
+ .flags = JAILHOUSE_PCICAPS_WRITE,
+ },
},
};