Home

Awesome

vfio-pci-bind

This script takes one or two parameters in any order:

and then:

  1. If both Vendor:Device and Domain:Bus:Device.Function were provided, validate that the requested Vendor:Device exists at Domain:Bus:Device.Function

    If only Vendor:Device was provided, determine the current Domain:Bus:Device.Function for that device.

    If only Domain:Bus:Device.Function was provided, use it.

  2. Unbinds all devices that are in the same iommu group as the supplied device from their current driver (except PCIe bridges).

  3. Binds to vfio-pci:

    1. The supplied device.
    2. All devices that are in the same iommu group.
  4. Transfers ownership of the respective iommu group inside /dev/vfio to $SUDO_USER

Suggestions:

Script must be executed via sudo!

Automatically binding devices on boot

Devices can be automatically bound to vfio-pci on boot using the supplied 25-vfio-pci-bind.rules udev rules file.

  1. Copy vfio-pci-bind.sh to /lib/udev/ and ensure it is marked executable.
  2. Copy 25-vfio-pci-bind.rules to /etc/udev/rules.d/
  3. Edit /etc/udev/rules.d/25-vfio-pci-bind.rules and add PCI device matching rules following the examples in the file.
  4. Reboot.

License

See supplied LICENSE file.