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