Assigning PCI devices to vfio_pci

LPAR mode KVM guest

Set up the vfio_pci device driver to control a particular PCIe card type by specifying the card's vendor code and device code.

After setting up the vfio_pci device driver for one or more PCIe card types, all eligible cards of these types get associated with the vfio_pci device driver. Free a card from control of its card-specific default device driver to make it eligible for the vfio_pci device driver.

Tip: Issue lspci -n to display the vendor and device codes for your PCIe devices in the format <vendor_code>:<device_code>.

Module parameter

You can use the ids= module parameter to specify the PCIe card types.

Figure 1. vfio_pci module parameter syntax

1  modprobe vfio_pci ids= + , <vendor_code>:<device_code>
Example: In this example, a PCIe device with function address 0001:000:000:0, vendor code 15b3, and device code 1003 is available on the host. The specification for the ids= module parameter makes the card type eligible for the vfio_pci device driver.
# lspci -n
0001:000:000:0 15b3:1003
# modprobe vfio_pci ids=15b3:1003
Draft comment: HorstWeber
Correct to assume that vfio_pci is a separate module?

sysfs interface

On a running host, you can use the /sys/bus/pci/drivers/vfio-pci/new_id sysfs attribute to enable the vfio_pci device driver to control a particular PCIe card type. Write the vendor code and device code, separated by a blank, to the attribute.

Example: This example, makes cards with vendor code 15b3 and device code 1003 eligible for the vfio_pci device driver.
# echo 15b3 1003 > /sys/bus/pci/drivers/vfio-pci/new_id