1*6f9bebf1SAkihiko Odaki.. SPDX-License-Identifier: GPL-2.0-or-later 2*6f9bebf1SAkihiko Odaki 3*6f9bebf1SAkihiko OdakiCompsable SR-IOV device 4*6f9bebf1SAkihiko Odaki======================= 5*6f9bebf1SAkihiko Odaki 6*6f9bebf1SAkihiko OdakiSR-IOV (Single Root I/O Virtualization) is an optional extended capability of a 7*6f9bebf1SAkihiko OdakiPCI Express device. It allows a single physical function (PF) to appear as 8*6f9bebf1SAkihiko Odakimultiple virtual functions (VFs) for the main purpose of eliminating software 9*6f9bebf1SAkihiko Odakioverhead in I/O from virtual machines. 10*6f9bebf1SAkihiko Odaki 11*6f9bebf1SAkihiko OdakiThere are devices with predefined SR-IOV configurations, but it is also possible 12*6f9bebf1SAkihiko Odakito compose an SR-IOV device yourself. Composing an SR-IOV device is currently 13*6f9bebf1SAkihiko Odakionly supported by virtio-net-pci. 14*6f9bebf1SAkihiko Odaki 15*6f9bebf1SAkihiko OdakiUsers can configure an SR-IOV-capable virtio-net device by adding 16*6f9bebf1SAkihiko Odakivirtio-net-pci functions to a bus. Below is a command line example: 17*6f9bebf1SAkihiko Odaki 18*6f9bebf1SAkihiko Odaki.. code-block:: shell 19*6f9bebf1SAkihiko Odaki 20*6f9bebf1SAkihiko Odaki -netdev user,id=n -netdev user,id=o 21*6f9bebf1SAkihiko Odaki -netdev user,id=p -netdev user,id=q 22*6f9bebf1SAkihiko Odaki -device pcie-root-port,id=b 23*6f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x3,netdev=q,sriov-pf=f 24*6f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x2,netdev=p,sriov-pf=f 25*6f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x1,netdev=o,sriov-pf=f 26*6f9bebf1SAkihiko Odaki -device virtio-net-pci,bus=b,addr=0x0.0x0,netdev=n,id=f 27*6f9bebf1SAkihiko Odaki 28*6f9bebf1SAkihiko OdakiThe VFs specify the paired PF with ``sriov-pf`` property. The PF must be 29*6f9bebf1SAkihiko Odakiadded after all VFs. It is the user's responsibility to ensure that VFs have 30*6f9bebf1SAkihiko Odakifunction numbers larger than one of the PF, and that the function numbers 31*6f9bebf1SAkihiko Odakihave a consistent stride. 32*6f9bebf1SAkihiko Odaki 33*6f9bebf1SAkihiko OdakiYou may also need to perform additional steps to activate the SR-IOV feature on 34*6f9bebf1SAkihiko Odakiyour guest. For Linux, refer to [1]_. 35*6f9bebf1SAkihiko Odaki 36*6f9bebf1SAkihiko Odaki.. [1] https://docs.kernel.org/PCI/pci-iov-howto.html 37