1a3d9f3a9SKlaus Jensen============== 2a3d9f3a9SKlaus JensenNVMe Emulation 3a3d9f3a9SKlaus Jensen============== 4a3d9f3a9SKlaus Jensen 5a3d9f3a9SKlaus JensenQEMU provides NVMe emulation through the ``nvme``, ``nvme-ns`` and 6a3d9f3a9SKlaus Jensen``nvme-subsys`` devices. 7a3d9f3a9SKlaus Jensen 8a3d9f3a9SKlaus JensenSee the following sections for specific information on 9a3d9f3a9SKlaus Jensen 10a3d9f3a9SKlaus Jensen * `Adding NVMe Devices`_, `additional namespaces`_ and `NVM subsystems`_. 11a3d9f3a9SKlaus Jensen * Configuration of `Optional Features`_ such as `Controller Memory Buffer`_, 12a3d9f3a9SKlaus Jensen `Simple Copy`_, `Zoned Namespaces`_, `metadata`_ and `End-to-End Data 13a3d9f3a9SKlaus Jensen Protection`_, 14a3d9f3a9SKlaus Jensen 15a3d9f3a9SKlaus JensenAdding NVMe Devices 16a3d9f3a9SKlaus Jensen=================== 17a3d9f3a9SKlaus Jensen 18a3d9f3a9SKlaus JensenController Emulation 19a3d9f3a9SKlaus Jensen-------------------- 20a3d9f3a9SKlaus Jensen 21a3d9f3a9SKlaus JensenThe QEMU emulated NVMe controller implements version 1.4 of the NVM Express 22a3d9f3a9SKlaus Jensenspecification. All mandatory features are implement with a couple of exceptions 23a3d9f3a9SKlaus Jensenand limitations: 24a3d9f3a9SKlaus Jensen 25a3d9f3a9SKlaus Jensen * Accounting numbers in the SMART/Health log page are reset when the device 26a3d9f3a9SKlaus Jensen is power cycled. 27a3d9f3a9SKlaus Jensen * Interrupt Coalescing is not supported and is disabled by default. 28a3d9f3a9SKlaus Jensen 29a3d9f3a9SKlaus JensenThe simplest way to attach an NVMe controller on the QEMU PCI bus is to add the 30a3d9f3a9SKlaus Jensenfollowing parameters: 31a3d9f3a9SKlaus Jensen 32a3d9f3a9SKlaus Jensen.. code-block:: console 33a3d9f3a9SKlaus Jensen 34a3d9f3a9SKlaus Jensen -drive file=nvm.img,if=none,id=nvm 35a3d9f3a9SKlaus Jensen -device nvme,serial=deadbeef,drive=nvm 36a3d9f3a9SKlaus Jensen 37a3d9f3a9SKlaus JensenThere are a number of optional general parameters for the ``nvme`` device. Some 38a3d9f3a9SKlaus Jensenare mentioned here, but see ``-device nvme,help`` to list all possible 39a3d9f3a9SKlaus Jensenparameters. 40a3d9f3a9SKlaus Jensen 41a3d9f3a9SKlaus Jensen``max_ioqpairs=UINT32`` (default: ``64``) 42a3d9f3a9SKlaus Jensen Set the maximum number of allowed I/O queue pairs. This replaces the 43a3d9f3a9SKlaus Jensen deprecated ``num_queues`` parameter. 44a3d9f3a9SKlaus Jensen 45a3d9f3a9SKlaus Jensen``msix_qsize=UINT16`` (default: ``65``) 46a3d9f3a9SKlaus Jensen The number of MSI-X vectors that the device should support. 47a3d9f3a9SKlaus Jensen 48a3d9f3a9SKlaus Jensen``mdts=UINT8`` (default: ``7``) 49a3d9f3a9SKlaus Jensen Set the Maximum Data Transfer Size of the device. 50a3d9f3a9SKlaus Jensen 51a3d9f3a9SKlaus Jensen``use-intel-id`` (default: ``off``) 52a3d9f3a9SKlaus Jensen Since QEMU 5.2, the device uses a QEMU allocated "Red Hat" PCI Device and 53a3d9f3a9SKlaus Jensen Vendor ID. Set this to ``on`` to revert to the unallocated Intel ID 54a3d9f3a9SKlaus Jensen previously used. 55a3d9f3a9SKlaus Jensen 56*23a4b3ebSStephen Bates``ocp`` (default: ``off``) 57*23a4b3ebSStephen Bates The Open Compute Project defines the Datacenter NVMe SSD Specification that 58*23a4b3ebSStephen Bates sits on top of NVMe. It describes additional commands and NVMe behaviors 59*23a4b3ebSStephen Bates specific for the Datacenter. When this option is ``on`` OCP features such as 60*23a4b3ebSStephen Bates the SMART / Health information extended log become available in the 61*23a4b3ebSStephen Bates controller. We emulate version 5 of this log page. 62*23a4b3ebSStephen Bates 63a3d9f3a9SKlaus JensenAdditional Namespaces 64a3d9f3a9SKlaus Jensen--------------------- 65a3d9f3a9SKlaus Jensen 66a3d9f3a9SKlaus JensenIn the simplest possible invocation sketched above, the device only support a 67a3d9f3a9SKlaus Jensensingle namespace with the namespace identifier ``1``. To support multiple 68a3d9f3a9SKlaus Jensennamespaces and additional features, the ``nvme-ns`` device must be used. 69a3d9f3a9SKlaus Jensen 70a3d9f3a9SKlaus Jensen.. code-block:: console 71a3d9f3a9SKlaus Jensen 72a3d9f3a9SKlaus Jensen -device nvme,id=nvme-ctrl-0,serial=deadbeef 73a3d9f3a9SKlaus Jensen -drive file=nvm-1.img,if=none,id=nvm-1 74a3d9f3a9SKlaus Jensen -device nvme-ns,drive=nvm-1 75a3d9f3a9SKlaus Jensen -drive file=nvm-2.img,if=none,id=nvm-2 76a3d9f3a9SKlaus Jensen -device nvme-ns,drive=nvm-2 77a3d9f3a9SKlaus Jensen 78a3d9f3a9SKlaus JensenThe namespaces defined by the ``nvme-ns`` device will attach to the most 79a3d9f3a9SKlaus Jensenrecently defined ``nvme-bus`` that is created by the ``nvme`` device. Namespace 80b980c1aeSStefan Weilidentifiers are allocated automatically, starting from ``1``. 81a3d9f3a9SKlaus Jensen 82a3d9f3a9SKlaus JensenThere are a number of parameters available: 83a3d9f3a9SKlaus Jensen 84a3d9f3a9SKlaus Jensen``nsid`` (default: ``0``) 85a3d9f3a9SKlaus Jensen Explicitly set the namespace identifier. 86a3d9f3a9SKlaus Jensen 87a3d9f3a9SKlaus Jensen``uuid`` (default: *autogenerated*) 88a3d9f3a9SKlaus Jensen Set the UUID of the namespace. This will be reported as a "Namespace UUID" 89a3d9f3a9SKlaus Jensen descriptor in the Namespace Identification Descriptor List. 90a3d9f3a9SKlaus Jensen 91bdc31646SRoque Arcudia Hernandez``nguid`` 92bdc31646SRoque Arcudia Hernandez Set the NGUID of the namespace. This will be reported as a "Namespace Globally 93bdc31646SRoque Arcudia Hernandez Unique Identifier" descriptor in the Namespace Identification Descriptor List. 94bdc31646SRoque Arcudia Hernandez It is specified as a string of hexadecimal digits containing exactly 16 bytes 95bdc31646SRoque Arcudia Hernandez or "auto" for a random value. An optional '-' separator could be used to group 96bdc31646SRoque Arcudia Hernandez bytes. If not specified the NGUID will remain all zeros. 97bdc31646SRoque Arcudia Hernandez 986870cfb8SHeinrich Schuchardt``eui64`` 996870cfb8SHeinrich Schuchardt Set the EUI-64 of the namespace. This will be reported as a "IEEE Extended 1006870cfb8SHeinrich Schuchardt Unique Identifier" descriptor in the Namespace Identification Descriptor List. 1013276dde4SHeinrich Schuchardt Since machine type 6.1 a non-zero default value is used if the parameter 1023276dde4SHeinrich Schuchardt is not provided. For earlier machine types the field defaults to 0. 1036870cfb8SHeinrich Schuchardt 104a3d9f3a9SKlaus Jensen``bus`` 105a3d9f3a9SKlaus Jensen If there are more ``nvme`` devices defined, this parameter may be used to 106a3d9f3a9SKlaus Jensen attach the namespace to a specific ``nvme`` device (identified by an ``id`` 107a3d9f3a9SKlaus Jensen parameter on the controller device). 108a3d9f3a9SKlaus Jensen 109a3d9f3a9SKlaus JensenNVM Subsystems 110a3d9f3a9SKlaus Jensen-------------- 111a3d9f3a9SKlaus Jensen 112a3d9f3a9SKlaus JensenAdditional features becomes available if the controller device (``nvme``) is 113a3d9f3a9SKlaus Jensenlinked to an NVM Subsystem device (``nvme-subsys``). 114a3d9f3a9SKlaus Jensen 115a3d9f3a9SKlaus JensenThe NVM Subsystem emulation allows features such as shared namespaces and 116a3d9f3a9SKlaus Jensenmultipath I/O. 117a3d9f3a9SKlaus Jensen 118a3d9f3a9SKlaus Jensen.. code-block:: console 119a3d9f3a9SKlaus Jensen 120a3d9f3a9SKlaus Jensen -device nvme-subsys,id=nvme-subsys-0,nqn=subsys0 121146b5fa5SNiklas Cassel -device nvme,serial=deadbeef,subsys=nvme-subsys-0 122146b5fa5SNiklas Cassel -device nvme,serial=deadbeef,subsys=nvme-subsys-0 123a3d9f3a9SKlaus Jensen 124a3d9f3a9SKlaus JensenThis will create an NVM subsystem with two controllers. Having controllers 125a3d9f3a9SKlaus Jensenlinked to an ``nvme-subsys`` device allows additional ``nvme-ns`` parameters: 126a3d9f3a9SKlaus Jensen 127916b0f0bSKlaus Jensen``shared`` (default: ``on`` since 6.2) 128a3d9f3a9SKlaus Jensen Specifies that the namespace will be attached to all controllers in the 129916b0f0bSKlaus Jensen subsystem. If set to ``off``, the namespace will remain a private namespace 130916b0f0bSKlaus Jensen and may only be attached to a single controller at a time. Shared namespaces 131916b0f0bSKlaus Jensen are always automatically attached to all controllers (also when controllers 132916b0f0bSKlaus Jensen are hotplugged). 133a3d9f3a9SKlaus Jensen 134a3d9f3a9SKlaus Jensen``detached`` (default: ``off``) 135a3d9f3a9SKlaus Jensen If set to ``on``, the namespace will be be available in the subsystem, but 136916b0f0bSKlaus Jensen not attached to any controllers initially. A shared namespace with this set 137916b0f0bSKlaus Jensen to ``on`` will never be automatically attached to controllers. 138a3d9f3a9SKlaus Jensen 139a3d9f3a9SKlaus JensenThus, adding 140a3d9f3a9SKlaus Jensen 141a3d9f3a9SKlaus Jensen.. code-block:: console 142a3d9f3a9SKlaus Jensen 143a3d9f3a9SKlaus Jensen -drive file=nvm-1.img,if=none,id=nvm-1 144916b0f0bSKlaus Jensen -device nvme-ns,drive=nvm-1,nsid=1 145a3d9f3a9SKlaus Jensen -drive file=nvm-2.img,if=none,id=nvm-2 146916b0f0bSKlaus Jensen -device nvme-ns,drive=nvm-2,nsid=3,shared=off,detached=on 147a3d9f3a9SKlaus Jensen 148916b0f0bSKlaus Jensenwill cause NSID 1 will be a shared namespace that is initially attached to both 149916b0f0bSKlaus Jensencontrollers. NSID 3 will be a private namespace due to ``shared=off`` and only 150916b0f0bSKlaus Jensenattachable to a single controller at a time. Additionally it will not be 151916b0f0bSKlaus Jensenattached to any controller initially (due to ``detached=on``) or to hotplugged 152916b0f0bSKlaus Jensencontrollers. 153a3d9f3a9SKlaus Jensen 154a3d9f3a9SKlaus JensenOptional Features 155a3d9f3a9SKlaus Jensen================= 156a3d9f3a9SKlaus Jensen 157a3d9f3a9SKlaus JensenController Memory Buffer 158a3d9f3a9SKlaus Jensen------------------------ 159a3d9f3a9SKlaus Jensen 160a3d9f3a9SKlaus Jensen``nvme`` device parameters related to the Controller Memory Buffer support: 161a3d9f3a9SKlaus Jensen 162a3d9f3a9SKlaus Jensen``cmb_size_mb=UINT32`` (default: ``0``) 163a3d9f3a9SKlaus Jensen This adds a Controller Memory Buffer of the given size at offset zero in BAR 164a3d9f3a9SKlaus Jensen 2. 165a3d9f3a9SKlaus Jensen 166a3d9f3a9SKlaus Jensen``legacy-cmb`` (default: ``off``) 167a3d9f3a9SKlaus Jensen By default, the device uses the "v1.4 scheme" for the Controller Memory 168a3d9f3a9SKlaus Jensen Buffer support (i.e, the CMB is initially disabled and must be explicitly 169a3d9f3a9SKlaus Jensen enabled by the host). Set this to ``on`` to behave as a v1.3 device wrt. the 170a3d9f3a9SKlaus Jensen CMB. 171a3d9f3a9SKlaus Jensen 172a3d9f3a9SKlaus JensenSimple Copy 173a3d9f3a9SKlaus Jensen----------- 174a3d9f3a9SKlaus Jensen 175a3d9f3a9SKlaus JensenThe device includes support for TP 4065 ("Simple Copy Command"). A number of 176a3d9f3a9SKlaus Jensenadditional ``nvme-ns`` device parameters may be used to control the Copy 177a3d9f3a9SKlaus Jensencommand limits: 178a3d9f3a9SKlaus Jensen 179a3d9f3a9SKlaus Jensen``mssrl=UINT16`` (default: ``128``) 180a3d9f3a9SKlaus Jensen Set the Maximum Single Source Range Length (``MSSRL``). This is the maximum 181a3d9f3a9SKlaus Jensen number of logical blocks that may be specified in each source range. 182a3d9f3a9SKlaus Jensen 183a3d9f3a9SKlaus Jensen``mcl=UINT32`` (default: ``128``) 184a3d9f3a9SKlaus Jensen Set the Maximum Copy Length (``MCL``). This is the maximum number of logical 185a3d9f3a9SKlaus Jensen blocks that may be specified in a Copy command (the total for all source 186a3d9f3a9SKlaus Jensen ranges). 187a3d9f3a9SKlaus Jensen 188a3d9f3a9SKlaus Jensen``msrc=UINT8`` (default: ``127``) 189a3d9f3a9SKlaus Jensen Set the Maximum Source Range Count (``MSRC``). This is the maximum number of 190a3d9f3a9SKlaus Jensen source ranges that may be used in a Copy command. This is a 0's based value. 191a3d9f3a9SKlaus Jensen 192a3d9f3a9SKlaus JensenZoned Namespaces 193a3d9f3a9SKlaus Jensen---------------- 194a3d9f3a9SKlaus Jensen 195a3d9f3a9SKlaus JensenA namespaces may be "Zoned" as defined by TP 4053 ("Zoned Namespaces"). Set 196a3d9f3a9SKlaus Jensen``zoned=on`` on an ``nvme-ns`` device to configure it as a zoned namespace. 197a3d9f3a9SKlaus Jensen 198a3d9f3a9SKlaus JensenThe namespace may be configured with additional parameters 199a3d9f3a9SKlaus Jensen 200a3d9f3a9SKlaus Jensen``zoned.zone_size=SIZE`` (default: ``128MiB``) 201a3d9f3a9SKlaus Jensen Define the zone size (``ZSZE``). 202a3d9f3a9SKlaus Jensen 203a3d9f3a9SKlaus Jensen``zoned.zone_capacity=SIZE`` (default: ``0``) 204a3d9f3a9SKlaus Jensen Define the zone capacity (``ZCAP``). If left at the default (``0``), the zone 205a3d9f3a9SKlaus Jensen capacity will equal the zone size. 206a3d9f3a9SKlaus Jensen 207a3d9f3a9SKlaus Jensen``zoned.descr_ext_size=UINT32`` (default: ``0``) 208a3d9f3a9SKlaus Jensen Set the Zone Descriptor Extension Size (``ZDES``). Must be a multiple of 64 209a3d9f3a9SKlaus Jensen bytes. 210a3d9f3a9SKlaus Jensen 211a3d9f3a9SKlaus Jensen``zoned.cross_read=BOOL`` (default: ``off``) 212a3d9f3a9SKlaus Jensen Set to ``on`` to allow reads to cross zone boundaries. 213a3d9f3a9SKlaus Jensen 214a3d9f3a9SKlaus Jensen``zoned.max_active=UINT32`` (default: ``0``) 215a3d9f3a9SKlaus Jensen Set the maximum number of active resources (``MAR``). The default (``0``) 216a3d9f3a9SKlaus Jensen allows all zones to be active. 217a3d9f3a9SKlaus Jensen 218a3d9f3a9SKlaus Jensen``zoned.max_open=UINT32`` (default: ``0``) 219a3d9f3a9SKlaus Jensen Set the maximum number of open resources (``MOR``). The default (``0``) 220a3d9f3a9SKlaus Jensen allows all zones to be open. If ``zoned.max_active`` is specified, this value 221a3d9f3a9SKlaus Jensen must be less than or equal to that. 222a3d9f3a9SKlaus Jensen 223176c0a49SKeith Busch``zoned.zasl=UINT8`` (default: ``0``) 224176c0a49SKeith Busch Set the maximum data transfer size for the Zone Append command. Like 225176c0a49SKeith Busch ``mdts``, the value is specified as a power of two (2^n) and is in units of 226176c0a49SKeith Busch the minimum memory page size (CAP.MPSMIN). The default value (``0``) 227176c0a49SKeith Busch has this property inherit the ``mdts`` value. 228176c0a49SKeith Busch 229e409c905SKlaus JensenFlexible Data Placement 230e409c905SKlaus Jensen----------------------- 231e409c905SKlaus Jensen 232e409c905SKlaus JensenThe device may be configured to support TP4146 ("Flexible Data Placement") by 233e409c905SKlaus Jensenconfiguring it (``fdp=on``) on the subsystem:: 234e409c905SKlaus Jensen 235e409c905SKlaus Jensen -device nvme-subsys,id=nvme-subsys-0,nqn=subsys0,fdp=on,fdp.nruh=16 236e409c905SKlaus Jensen 237e409c905SKlaus JensenThe subsystem emulates a single Endurance Group, on which Flexible Data 238e409c905SKlaus JensenPlacement will be supported. Also note that the device emulation deviates 239e409c905SKlaus Jensenslightly from the specification, by always enabling the "FDP Mode" feature on 240e409c905SKlaus Jensenthe controller if the subsystems is configured for Flexible Data Placement. 241e409c905SKlaus Jensen 242e409c905SKlaus JensenEnabling Flexible Data Placement on the subsyste enables the following 243e409c905SKlaus Jensenparameters: 244e409c905SKlaus Jensen 245e409c905SKlaus Jensen``fdp.nrg`` (default: ``1``) 246e409c905SKlaus Jensen Set the number of Reclaim Groups. 247e409c905SKlaus Jensen 248e409c905SKlaus Jensen``fdp.nruh`` (default: ``0``) 249313e1629SStefan Weil Set the number of Reclaim Unit Handles. This is a mandatory parameter and 250e409c905SKlaus Jensen must be non-zero. 251e409c905SKlaus Jensen 252e409c905SKlaus Jensen``fdp.runs`` (default: ``96M``) 253e409c905SKlaus Jensen Set the Reclaim Unit Nominal Size. Defaults to 96 MiB. 254e409c905SKlaus Jensen 255e409c905SKlaus JensenNamespaces within this subsystem may requests Reclaim Unit Handles:: 256e409c905SKlaus Jensen 257e409c905SKlaus Jensen -device nvme-ns,drive=nvm-1,fdp.ruhs=RUHLIST 258e409c905SKlaus Jensen 259e409c905SKlaus JensenThe ``RUHLIST`` is a semicolon separated list (i.e. ``0;1;2;3``) and may 260e409c905SKlaus Jenseninclude ranges (i.e. ``0;8-15``). If no reclaim unit handle list is specified, 261e409c905SKlaus Jensenthe controller will assign the controller-specified reclaim unit handle to 262e409c905SKlaus Jensenplacement handle identifier 0. 263e409c905SKlaus Jensen 264a3d9f3a9SKlaus JensenMetadata 265a3d9f3a9SKlaus Jensen-------- 266a3d9f3a9SKlaus Jensen 267a3d9f3a9SKlaus JensenThe virtual namespace device supports LBA metadata in the form separate 268a3d9f3a9SKlaus Jensenmetadata (``MPTR``-based) and extended LBAs. 269a3d9f3a9SKlaus Jensen 270a3d9f3a9SKlaus Jensen``ms=UINT16`` (default: ``0``) 271a3d9f3a9SKlaus Jensen Defines the number of metadata bytes per LBA. 272a3d9f3a9SKlaus Jensen 273a3d9f3a9SKlaus Jensen``mset=UINT8`` (default: ``0``) 274a3d9f3a9SKlaus Jensen Set to ``1`` to enable extended LBAs. 275a3d9f3a9SKlaus Jensen 276a3d9f3a9SKlaus JensenEnd-to-End Data Protection 277a3d9f3a9SKlaus Jensen-------------------------- 278a3d9f3a9SKlaus Jensen 279a3d9f3a9SKlaus JensenThe virtual namespace device supports DIF- and DIX-based protection information 280a3d9f3a9SKlaus Jensen(depending on ``mset``). 281a3d9f3a9SKlaus Jensen 282a3d9f3a9SKlaus Jensen``pi=UINT8`` (default: ``0``) 283a3d9f3a9SKlaus Jensen Enable protection information of the specified type (type ``1``, ``2`` or 284a3d9f3a9SKlaus Jensen ``3``). 285a3d9f3a9SKlaus Jensen 286a3d9f3a9SKlaus Jensen``pil=UINT8`` (default: ``0``) 287a3d9f3a9SKlaus Jensen Controls the location of the protection information within the metadata. Set 288ec5a138cSAnkit Kumar to ``1`` to transfer protection information as the first bytes of metadata. 289ec5a138cSAnkit Kumar Otherwise, the protection information is transferred as the last bytes of 290ec5a138cSAnkit Kumar metadata. 291ec5a138cSAnkit Kumar 292ec5a138cSAnkit Kumar``pif=UINT8`` (default: ``0``) 293ec5a138cSAnkit Kumar By default, the namespace device uses 16 bit guard protection information 294ec5a138cSAnkit Kumar format (``pif=0``). Set to ``2`` to enable 64 bit guard protection 295ec5a138cSAnkit Kumar information format. This requires at least 16 bytes of metadata. Note that 296ec5a138cSAnkit Kumar ``pif=1`` (32 bit guards) is currently not supported. 297751babf5SLukasz Maniak 298751babf5SLukasz ManiakVirtualization Enhancements and SR-IOV (Experimental Support) 299751babf5SLukasz Maniak------------------------------------------------------------- 300751babf5SLukasz Maniak 301751babf5SLukasz ManiakThe ``nvme`` device supports Single Root I/O Virtualization and Sharing 302751babf5SLukasz Maniakalong with Virtualization Enhancements. The controller has to be linked to 303751babf5SLukasz Maniakan NVM Subsystem device (``nvme-subsys``) for use with SR-IOV. 304751babf5SLukasz Maniak 305751babf5SLukasz ManiakA number of parameters are present (**please note, that they may be 306751babf5SLukasz Maniaksubject to change**): 307751babf5SLukasz Maniak 308751babf5SLukasz Maniak``sriov_max_vfs`` (default: ``0``) 309751babf5SLukasz Maniak Indicates the maximum number of PCIe virtual functions supported 310751babf5SLukasz Maniak by the controller. Specifying a non-zero value enables reporting of both 311751babf5SLukasz Maniak SR-IOV and ARI (Alternative Routing-ID Interpretation) capabilities 312751babf5SLukasz Maniak by the NVMe device. Virtual function controllers will not report SR-IOV. 313751babf5SLukasz Maniak 314751babf5SLukasz Maniak``sriov_vq_flexible`` 315751babf5SLukasz Maniak Indicates the total number of flexible queue resources assignable to all 316751babf5SLukasz Maniak the secondary controllers. Implicitly sets the number of primary 317751babf5SLukasz Maniak controller's private resources to ``(max_ioqpairs - sriov_vq_flexible)``. 318751babf5SLukasz Maniak 319751babf5SLukasz Maniak``sriov_vi_flexible`` 320751babf5SLukasz Maniak Indicates the total number of flexible interrupt resources assignable to 321751babf5SLukasz Maniak all the secondary controllers. Implicitly sets the number of primary 322751babf5SLukasz Maniak controller's private resources to ``(msix_qsize - sriov_vi_flexible)``. 323751babf5SLukasz Maniak 324751babf5SLukasz Maniak``sriov_max_vi_per_vf`` (default: ``0``) 325751babf5SLukasz Maniak Indicates the maximum number of virtual interrupt resources assignable 326751babf5SLukasz Maniak to a secondary controller. The default ``0`` resolves to 327751babf5SLukasz Maniak ``(sriov_vi_flexible / sriov_max_vfs)`` 328751babf5SLukasz Maniak 329751babf5SLukasz Maniak``sriov_max_vq_per_vf`` (default: ``0``) 330751babf5SLukasz Maniak Indicates the maximum number of virtual queue resources assignable to 331751babf5SLukasz Maniak a secondary controller. The default ``0`` resolves to 332751babf5SLukasz Maniak ``(sriov_vq_flexible / sriov_max_vfs)`` 333751babf5SLukasz Maniak 334751babf5SLukasz ManiakThe simplest possible invocation enables the capability to set up one VF 335751babf5SLukasz Maniakcontroller and assign an admin queue, an IO queue, and a MSI-X interrupt. 336751babf5SLukasz Maniak 337751babf5SLukasz Maniak.. code-block:: console 338751babf5SLukasz Maniak 339751babf5SLukasz Maniak -device nvme-subsys,id=subsys0 340751babf5SLukasz Maniak -device nvme,serial=deadbeef,subsys=subsys0,sriov_max_vfs=1, 341751babf5SLukasz Maniak sriov_vq_flexible=2,sriov_vi_flexible=1 342751babf5SLukasz Maniak 343751babf5SLukasz ManiakThe minimum steps required to configure a functional NVMe secondary 344751babf5SLukasz Maniakcontroller are: 345751babf5SLukasz Maniak 346751babf5SLukasz Maniak * unbind flexible resources from the primary controller 347751babf5SLukasz Maniak 348751babf5SLukasz Maniak.. code-block:: console 349751babf5SLukasz Maniak 350751babf5SLukasz Maniak nvme virt-mgmt /dev/nvme0 -c 0 -r 1 -a 1 -n 0 351751babf5SLukasz Maniak nvme virt-mgmt /dev/nvme0 -c 0 -r 0 -a 1 -n 0 352751babf5SLukasz Maniak 353751babf5SLukasz Maniak * perform a Function Level Reset on the primary controller to actually 354751babf5SLukasz Maniak release the resources 355751babf5SLukasz Maniak 356751babf5SLukasz Maniak.. code-block:: console 357751babf5SLukasz Maniak 358751babf5SLukasz Maniak echo 1 > /sys/bus/pci/devices/0000:01:00.0/reset 359751babf5SLukasz Maniak 360751babf5SLukasz Maniak * enable VF 361751babf5SLukasz Maniak 362751babf5SLukasz Maniak.. code-block:: console 363751babf5SLukasz Maniak 364751babf5SLukasz Maniak echo 1 > /sys/bus/pci/devices/0000:01:00.0/sriov_numvfs 365751babf5SLukasz Maniak 366751babf5SLukasz Maniak * assign the flexible resources to the VF and set it ONLINE 367751babf5SLukasz Maniak 368751babf5SLukasz Maniak.. code-block:: console 369751babf5SLukasz Maniak 370751babf5SLukasz Maniak nvme virt-mgmt /dev/nvme0 -c 1 -r 1 -a 8 -n 1 371751babf5SLukasz Maniak nvme virt-mgmt /dev/nvme0 -c 1 -r 0 -a 8 -n 2 372751babf5SLukasz Maniak nvme virt-mgmt /dev/nvme0 -c 1 -r 0 -a 9 -n 0 373751babf5SLukasz Maniak 374751babf5SLukasz Maniak * bind the NVMe driver to the VF 375751babf5SLukasz Maniak 376751babf5SLukasz Maniak.. code-block:: console 377751babf5SLukasz Maniak 378751babf5SLukasz Maniak echo 0000:01:00.1 > /sys/bus/pci/drivers/nvme/bind 379