To make a PCIe device eligible as a VFIO pass-through device, you must bring it under
control of the vfio_pci
device driver.
Before you begin
PCI devices can be configured for automatic management by libvirt, as described in Configuring pass-through PCI devices. This management includes a dynamic host preparation.
Perform the steps that follow only for devices that are not managed by libvirt.
Procedure
- Free the intended pass-through PCI devices from the applicable PCI device driver by
writing their function address to
/sys/bus/pci/drivers/<pci_device_driver>/unbind.
# echo <function_address> > /sys/bus/pci/drivers/<pci_device_driver>/unbind
In
the path,
<pci_device_driver> is the name of the device driver that handles
the particular PCI device, for example
mlx4_core
for 10 GbE RoCE Express
devices.
Tip: Issue lspci -v to find out which device driver controls
the device.
- Configure the vfio-pci device driver.
You must ensure that the vfio-pci device
driver is operational and configured to control the intended PCI card types. You need to specify the
applicable vendor code and device code to configure a specific card type.
Tip: Issue
lspci -n to display the vendor and device codes for your PCI devices in the
format <vendor_code>:<device_code>.
Example
To make a 10 GbE RoCE Express device with function address 0001:000:000:0
eligible for KVM
guests:# lspci -n
0001:000:000:0 15b3:1003
# echo 0001:000:000:0 > /sys/bus/pci/drivers/mlx4_core/unbind
# modprobe vfio_pci ids=15b3:1003
What to do next
You can now configure a virtual PCI device as a pass-through device that is based on the device
at function address 0001:000:000:0
. For more information, see Configuring pass-through PCI devices.