16f9bebf1SAkihiko Odaki.. SPDX-License-Identifier: GPL-2.0-or-later 26f9bebf1SAkihiko Odaki 36f9bebf1SAkihiko OdakiCompsable SR-IOV device 46f9bebf1SAkihiko Odaki======================= 56f9bebf1SAkihiko Odaki 66f9bebf1SAkihiko OdakiSR-IOV (Single Root I/O Virtualization) is an optional extended capability of a 76f9bebf1SAkihiko OdakiPCI Express device. It allows a single physical function (PF) to appear as 86f9bebf1SAkihiko Odakimultiple virtual functions (VFs) for the main purpose of eliminating software 96f9bebf1SAkihiko Odakioverhead in I/O from virtual machines. 106f9bebf1SAkihiko Odaki 116f9bebf1SAkihiko OdakiThere are devices with predefined SR-IOV configurations, but it is also possible 126f9bebf1SAkihiko Odakito compose an SR-IOV device yourself. Composing an SR-IOV device is currently 136f9bebf1SAkihiko Odakionly supported by virtio-net-pci. 146f9bebf1SAkihiko Odaki 156f9bebf1SAkihiko OdakiUsers can configure an SR-IOV-capable virtio-net device by adding 166f9bebf1SAkihiko Odakivirtio-net-pci functions to a bus. Below is a command line example: 176f9bebf1SAkihiko Odaki 186f9bebf1SAkihiko Odaki.. code-block:: shell 196f9bebf1SAkihiko Odaki 206f9bebf1SAkihiko Odaki -netdev user,id=n -netdev user,id=o 216f9bebf1SAkihiko Odaki -netdev user,id=p -netdev user,id=q 226f9bebf1SAkihiko Odaki -device pcie-root-port,id=b 236f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x3,netdev=q,sriov-pf=f 246f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x2,netdev=p,sriov-pf=f 256f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x1,netdev=o,sriov-pf=f 266f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x0,netdev=n,id=f 276f9bebf1SAkihiko Odaki 286f9bebf1SAkihiko OdakiThe VFs specify the paired PF with ``sriov-pf`` property. The PF must be 296f9bebf1SAkihiko Odakiadded after all VFs. It is the user's responsibility to ensure that VFs have 306f9bebf1SAkihiko Odakifunction numbers larger than one of the PF, and that the function numbers 31*d0c280d3SAkihiko Odakihave a consistent stride. Both the PF and VFs are ARI-capable so you can have 32*d0c280d3SAkihiko Odaki255 VFs at maximum. 336f9bebf1SAkihiko Odaki 346f9bebf1SAkihiko OdakiYou may also need to perform additional steps to activate the SR-IOV feature on 356f9bebf1SAkihiko Odakiyour guest. For Linux, refer to [1]_. 366f9bebf1SAkihiko Odaki 376f9bebf1SAkihiko Odaki.. [1] https://docs.kernel.org/PCI/pci-iov-howto.html 38