This series implements PCI pass-through using VFIO in kvmtool. We introduce a new parameter to lkvm run, --vfio-pci, that takes a device number ([domain:]bus:dev.fn) as argument and passes it to the guest. This implementation is incomplete, missing a lot of features at the moment (for example power management or PCI express capabilities). But it was sufficient to pass an Intel x540 NIC to a guest on AMD Seattle, and an e1000e on QEMU q35. Changes since v3 [1]: * Improve command-line interface. Instead of passing an IOMMU group, pass the PCI RID. * Trap regions that can't be mmap'd (patch 10 is new). This is used for I/O port and sub-page regions. * Fix capability handling, again. One day I'll get it right. [1] https://www.spinics.net/lists/kvm/msg157844.html [2] git://linux-arm.org/kvmtool-jpb.git vfio/v4 Jean-Philippe Brucker (12): pci: add config operations callbacks on the PCI header pci: allow to specify IRQ type for PCI devices irq: add irqfd helpers Extend memory bank API with memory types pci: add capability helpers Import VFIO headers Add PCI device passthrough using VFIO vfio-pci: add MSI-X support vfio-pci: add MSI support vfio: Support non-mmappable regions Introduce reserved memory regions vfio: check reserved regions before mapping DMA Makefile | 2 + arm/gic.c | 74 ++- arm/include/arm-common/gic.h | 6 + arm/kvm.c | 2 +- arm/pci.c | 4 +- builtin-run.c | 5 + hw/pci-shmem.c | 12 +- hw/vesa.c | 2 +- include/kvm/irq.h | 17 + include/kvm/kvm-config.h | 3 + include/kvm/kvm.h | 54 +- include/kvm/pci.h | 118 ++++- include/kvm/vfio.h | 127 +++++ include/linux/vfio.h | 719 +++++++++++++++++++++++++ irq.c | 31 ++ kvm.c | 99 +++- mips/kvm.c | 6 +- pci.c | 105 ++-- powerpc/kvm.c | 2 +- vfio/core.c | 670 ++++++++++++++++++++++++ vfio/pci.c | 1184 ++++++++++++++++++++++++++++++++++++++++++ virtio/net.c | 9 +- virtio/scsi.c | 10 +- x86/kvm.c | 6 +- 24 files changed, 3144 insertions(+), 123 deletions(-) create mode 100644 include/kvm/vfio.h create mode 100644 include/linux/vfio.h create mode 100644 vfio/core.c create mode 100644 vfio/pci.c -- 2.14.3