This patchset provide very basic functionalities for interrupt remapping (IR) support of the emulated Intel IOMMU device.
By default, IR is disabled to be better compatible with current QEMU. To enable IR, we can using the following command to boot a IR-supported VM with basic network (still do not support kvm-ioapic, so we need to specify kernel_irqchip=off here): $ qemu-system-x86_64 -M q35,iommu=on,int_remap=on,kernel_irqchip=off \ -enable-kvm -m 1024 -s \ -monitor telnet::3333,server,nowait \ -netdev user,id=user.0,hostfwd=tcp::5555-:22 \ -device virtio-net-pci,netdev=user.0 \ /var/lib/libvirt/images/vm1.qcow2 When guest boots, we can verify whether IR enabled by grepping the dmesg like: [root@localhost ~]# journalctl -k | grep "DMAR-IR" Feb 19 11:21:23 localhost.localdomain kernel: DMAR-IR: IOAPIC id 0 under DRHD base 0xfed90000 IOMMU 0 Feb 19 11:21:23 localhost.localdomain kernel: DMAR-IR: Enabled IRQ remapping in xapic mode Currently only two devices are supported: - Emulated IOAPIC device - PCI Devices TODO List: - kvm-ioapic support - vhost support - pass through device support - EIM support - IR fault reporting - source-id validation for IRTE - IRTE cache and better queued invalidation - migration support (for IOMMU as general?) - more? Peter Xu (13): q35: add "int-remap" flag to enable intr acpi: enable INTR for DMAR report structure intel_iommu: allow queued invalidation for IR intel_iommu: set IR bit for ECAP register acpi: add DMAR scope definition for root IOAPIC intel_iommu: define interrupt remap table addr register intel_iommu: handle interrupt remap enable intel_iommu: define several structs for IOMMU IR intel_iommu: provide helper function vtd_get_iommu ioapic-common: add iommu for IOAPICCommonState intel_iommu: add IR translation faults defines intel_iommu: ioapic: IR support for emulated IOAPIC intel_iommu: Add support for PCI MSI remap hw/core/machine.c | 20 ++ hw/i386/acpi-build.c | 41 +++- hw/i386/intel_iommu.c | 397 +++++++++++++++++++++++++++++++++++++- hw/i386/intel_iommu_internal.h | 25 +++ hw/intc/ioapic.c | 36 +++- hw/intc/ioapic_common.c | 2 + hw/pci-host/q35.c | 6 +- include/hw/acpi/acpi-defs.h | 15 ++ include/hw/boards.h | 1 + include/hw/i386/intel_iommu.h | 121 ++++++++++++ include/hw/i386/ioapic_internal.h | 3 + include/hw/pci/msi.h | 4 + 12 files changed, 651 insertions(+), 20 deletions(-) -- 2.4.3