8.2. Configuring the VF Port on the Host
By default, the PF controls the AFU port. The following procedure transfers AFU control to the VF. After the transfer to VF control, applications running on the VM can access the AFU.
ls -l /sys/class/fpga/intel-fpga-dev.*
/sys/class/fpga/intel-fpga-dev.0 -> ../../devices/pci0000:36/0000:36:00.0/0000:37:00.0/fpga/intel-fpga-dev.0 /sys/class/fpga/intel-fpga-dev.1 -> ../../devices/pci0000:ae/0000:ae:00.0/0000:af:00.0/fpga/intel-fpga-dev.1
To target PCIe B:D.F (AF:00.0) and B:D.F (37:00.0) in the following commands, use instance id 1 and 0 instead of * respectively.
- Run the following three commands, individually, to export the required paths:
export port_path=$(find /sys/class/fpga/intel-fpga-dev.* \ -maxdepth 1 -follow -iname intel-fpga-port.*)
export link_path=$(readlink -m /$port_path/../)
- Release the port controlled by the PF using the fpgaport tool:
sudo fpgaport release /dev/intel-fpga-fme.* 0
- Enable SR-IOV and VFs. Each VF has 1 AFU Port:
sudo sh -c "echo 1 > $pci_path/sriov_numvfs"
- Find the additional device number for the VF device:
lspci -nn | grep :09cSample output:
04:00.0 Processing accelerators : Intel Corporation Device [8086:09c4] 04:00.1 Processing accelerators : Intel Corporation Device [8086:09c5]
lspci shows an additional device number, 09c5. This is the VF device you assign to a VM. The original bus and device numbers for the PF remains 09c4.
Note that the Domain:Bus:Device.Function (BDF) notation for the VF device in this example is: 000:04:00.1. Replace this BDF with the appropriate BDF for your system.
- Load the vfio-pci driver:
sudo modprobe vfio-pci
- Unbind the VF device from its driver:
sudo sh -c "echo 0000:04:00.1 > \ /sys/bus/pci/devices/0000:04:00.1/driver/unbind"
- Find the vendor and device ID for the VF device:
lspci -n -s 04:00.1
04:00.1 1200: 8086:09c5
- Bind the VF to the vfio-pci driver:
sudo sh -c "echo 8086 09c5 > \ /sys/bus/pci/drivers/vfio-pci/new_id"
Did you find the information on this page useful?