From: Jan Kiszka <[email protected]> QEMU 2.7 will have all the features we need to run Jailhouse with VT-d IOMMU. Remove the special cases from the code and document the new command line.
The requirement on the kernel version is not exact but a safe guess based on tests. Support for AMD-Vi (IOMMU) emulation in QEMU is still work in progress. So we leave the corresponding checks for that setup in place. Signed-off-by: Jan Kiszka <[email protected]> --- README.md | 8 ++++---- hypervisor/arch/x86/vtd.c | 40 ++-------------------------------------- 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b8ae219..da49cee 100644 --- a/README.md +++ b/README.md @@ -179,9 +179,8 @@ Demonstration in QEMU/KVM The included system configuration qemu-vm.c can be used to run Jailhouse in QEMU/KVM virtual machine on x86 hosts (Intel and AMD are supported). Currently -it requires Linux 3.18 or newer on the host side (Intel is fine with 3.17). -QEMU is required in a recent version (2.7) as well if you want to use the -configuration file included in the source tree. +it requires Linux 4.4 or newer on the host side. QEMU version 2.7 or newer is +required. You also need a Linux guest image with a recent kernel (tested with >= 3.9) and the ability to build a module for this kernel. Further steps depend on the type @@ -190,7 +189,8 @@ of CPU you have on your system. For Intel CPUs: Make sure the kvm-intel module was loaded with nested=1 to enable nested VMX support. Start the virtual machine as follows: - qemu-system-x86_64 -machine q35 -m 1G -enable-kvm -smp 4 \ + qemu-system-x86_64 -machine q35,kernel_irqchip=split -m 1G -enable-kvm + -smp 4 -device intel-iommu,intremap=on \ -cpu kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx \ -drive file=LinuxInstallation.img,format=raw|qcow2|...,id=disk,if=none \ -device ide-hd,drive=disk -serial stdio -serial vc \ diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index aaed326..5b44b55 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -630,12 +630,8 @@ int iommu_init(void) return err; version = mmio_read64(reg_base + VTD_VER_REG) & VTD_VER_MASK; - if (version < VTD_VER_MIN || version == 0xff) { - //return -EIO; - // HACK for QEMU - printk("WARNING: No VT-d support found!\n"); - return 0; - } + if (version < VTD_VER_MIN || version == 0xff) + return -EIO; printk("DMAR unit @0x%lx/0x%x\n", unit->base, unit->size); @@ -792,10 +788,6 @@ int iommu_add_pci_device(struct cell *cell, struct pci_device *device) struct vtd_entry *context_entry_table, *context_entry; int result; - // HACK for QEMU - if (dmar_units == 0) - return 0; - result = vtd_reserve_int_remap_region(bdf, max_vectors); if (result < 0) return result; @@ -835,10 +827,6 @@ void iommu_remove_pci_device(struct pci_device *device) struct vtd_entry *context_entry; unsigned int n; - // HACK for QEMU - if (dmar_units == 0) - return; - vtd_free_int_remap_region(bdf, MAX(device->info->num_msi_vectors, device->info->num_msix_vectors)); @@ -864,10 +852,6 @@ int iommu_cell_init(struct cell *cell) unsigned int n; int result; - // HACK for QEMU - if (dmar_units == 0) - return 0; - if (cell->id >= dmar_num_did) return trace_error(-ERANGE); @@ -894,10 +878,6 @@ int iommu_map_memory_region(struct cell *cell, { u32 flags = 0; - // HACK for QEMU - if (dmar_units == 0) - return 0; - if (!(mem->flags & JAILHOUSE_MEM_DMA)) return 0; @@ -917,10 +897,6 @@ int iommu_map_memory_region(struct cell *cell, int iommu_unmap_memory_region(struct cell *cell, const struct jailhouse_memory *mem) { - // HACK for QEMU - if (dmar_units == 0) - return 0; - if (!(mem->flags & JAILHOUSE_MEM_DMA)) return 0; @@ -976,10 +952,6 @@ int iommu_map_interrupt(struct cell *cell, u16 device_id, unsigned int vector, union vtd_irte irte; int base_index; - // HACK for QEMU - if (dmar_units == 0) - return -ENOSYS; - base_index = vtd_find_int_remap_region(device_id); if (base_index < 0) return base_index; @@ -1032,10 +1004,6 @@ update_irte: void iommu_cell_exit(struct cell *cell) { - // HACK for QEMU - if (dmar_units == 0) - return; - page_free(&mem_pool, cell->arch.vtd.pg_structs.root_table, 1); /* @@ -1050,10 +1018,6 @@ void iommu_config_commit(struct cell *cell_added_removed) void *reg_base = dmar_reg_base; int n; - // HACK for QEMU - if (dmar_units == 0) - return; - if (cell_added_removed) vtd_init_fault_nmi(); -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
