SR-IOV is a mechanism that enables PCI-E hardware to appear as multiple devices, called virtual functions.
This allows processes to have dedicated access to the PCI-E resources.
SR-IOV must be enabled in the UEFI/BIOS settings before use. Refer to the hardware vendor documentation for configuring.
On the host side, the SR-IOV must first be enabled by setting the number of virtual functions. For netplan this can be done by editing the netplan configuration and adding 'virtual-function-count' entry under the correct network interface(s). For adding 2 virtual functions to a network interface edit the netplan configuration as below:
network:
ethernets:
enp4s0:
virtual-function-count: 2
If using NetworkManager, execute sudo nmcli connection modify <connection name> sriov.total_vfs 2 where <connection name> is the NetworkManager connection for the network interface, nmcli connection command can be used to list the connections.
After setting up the SR-IOV virtual functions, the PCI address of the virtual function(s) can be listed by running ls -lha /sys/class/net/<interface>/device/ (replace <interface> with the network interface name).
This should show a file listing containing entries similar to the below, where the last part is the PCI address printed as <domain>:<bus>:<slot>:<function>.
lrwxrwxrwx 1 root root 0 May 9 10:23 virtfn0 -> ../0000:b2:10.0
lrwxrwxrwx 1 root root 0 May 9 10:23 virtfn1 -> ../0000:b2:10.4
With the VM powered off, edit the virtual machine configuration e.g. virsh edit ssc600-1 and add a new entry inside the <devices> XML node.
For example for adding the first virtual function from the above example, add the below to the configuration (replace the PCI address with the correct one for your hardware).
Make sure to remove the existing entry for the network interface that is re-configured to use SR-IOV.
<interface type='hostdev' trustGuestRxFilters='yes'>
<driver name='vfio'/>
<source>
<address type='pci' domain='0x0000' bus='0xb2' slot='0x10' function='0x0'/>
</source>
</interface>
After this the VM can be started again.
Remember to update the interface mappings on the Network configuration page in the web HMI.