This patchset adds a new virt-pci driver to UML that allows users to pass through host PCI devices to UML via VFIO. Currently, only MSI-X capable devices are supported, and drivers are assumed to use MSI-X.
This driver has been tested with virtio-net-pci, virtio-blk-pci and nvme in a QEMU virtual machine with virtual IOMMU enabled. Regression testing for virtio_pcidev has been limited as I haven't been able to find a virtio_pcidev vhost-user backend implementation. This patchset is based on the following patchset: https://lore.kernel.org/all/20250306150747.2926434-1-tiwei....@antgroup.com/ Tiwei Bie (3): um: Rewrite the sigio workaround based on epoll and tgkill um: virt-pci: Refactor virtio_pcidev into its own module um: Add VFIO-based virtual PCI driver arch/um/drivers/Kconfig | 20 +- arch/um/drivers/Makefile | 5 +- arch/um/drivers/random.c | 2 +- arch/um/drivers/rtc_user.c | 2 +- arch/um/drivers/vfio_kern.c | 648 +++++++++++++++++++++++++++++ arch/um/drivers/vfio_user.c | 323 +++++++++++++++ arch/um/drivers/vfio_user.h | 44 ++ arch/um/drivers/virt-pci.c | 699 ++++++-------------------------- arch/um/drivers/virt-pci.h | 41 ++ arch/um/drivers/virtio_pcidev.c | 628 ++++++++++++++++++++++++++++ arch/um/include/shared/os.h | 2 +- arch/um/include/shared/sigio.h | 1 - arch/um/kernel/sigio.c | 26 -- arch/um/os-Linux/sigio.c | 330 ++------------- 14 files changed, 1866 insertions(+), 905 deletions(-) create mode 100644 arch/um/drivers/vfio_kern.c create mode 100644 arch/um/drivers/vfio_user.c create mode 100644 arch/um/drivers/vfio_user.h create mode 100644 arch/um/drivers/virt-pci.h create mode 100644 arch/um/drivers/virtio_pcidev.c -- 2.34.1