mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-03 12:55:45 +00:00
docs: update nodedev driver docs for new mdev features
Add up-to-date information about creating and defining mediated devices in libvirt. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
70801504ca
commit
eba98a1db9
@ -14,13 +14,26 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The node device driver provides means to list and show details about host
|
The node device driver provides means to list and show details about host
|
||||||
devices (<code>virsh nodedev-list</code>,
|
devices (<code>virsh nodedev-list</code>, <code>virsh nodedev-info</code>,
|
||||||
<code>virsh nodedev-dumpxml</code>), which are generic and can be used
|
and <code>virsh nodedev-dumpxml</code>), which are generic and can be used
|
||||||
with all devices. It also provides means to create and destroy devices
|
with all devices. It also provides the means to manage virtual devices.
|
||||||
(<code>virsh nodedev-create</code>, <code>virsh nodedev-destroy</code>)
|
Persistently-defined virtual devices are only supported for mediated
|
||||||
which are meant to be used to create virtual devices, currently only
|
devices, while transient devices are supported by both mediated devices
|
||||||
supported by NPIV
|
and NPIV (<a href="https://wiki.libvirt.org/page/NPIV_in_libvirt">more
|
||||||
(<a href="https://wiki.libvirt.org/page/NPIV_in_libvirt">more info about NPIV)</a>).
|
info about NPIV)</a>).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Persistent virtual devices are managed with
|
||||||
|
<code>virsh nodedev-define</code> and <code>virsh nodedev-undefine</code>.
|
||||||
|
Persistent devices can be configured to start manually or automatically
|
||||||
|
using <code>virsh nodedev-autostart</code>. Inactive devices can be made
|
||||||
|
active with <code>virsh nodedev-start</code>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Transient virtual devices are started and stopped with the commands
|
||||||
|
<code>virsh nodedev-create</code> and <code>virsh nodedev-destroy</code>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
Devices on the host system are arranged in a tree-like hierarchy, with
|
Devices on the host system are arranged in a tree-like hierarchy, with
|
||||||
the root node being called <code>computer</code>. The node device driver
|
the root node being called <code>computer</code>. The node device driver
|
||||||
supports udev backend (HAL backend was removed in <code>6.8.0</code>).
|
supports udev backend (HAL backend was removed in <code>6.8.0</code>).
|
||||||
@ -198,6 +211,7 @@
|
|||||||
</driver>
|
</driver>
|
||||||
<capability type='mdev'>
|
<capability type='mdev'>
|
||||||
<type id='nvidia-11'/>
|
<type id='nvidia-11'/>
|
||||||
|
<uuid>4b20d080-1b54-4048-85b3-a6a62d165c01</uuid>
|
||||||
<iommuGroup number='12'/>
|
<iommuGroup number='12'/>
|
||||||
</capability>
|
</capability>
|
||||||
</device></pre>
|
</device></pre>
|
||||||
@ -216,22 +230,31 @@
|
|||||||
display device details
|
display device details
|
||||||
(<span class="since">Since 3.4.0</span>)
|
(<span class="since">Since 3.4.0</span>)
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
create transient mediated devices
|
||||||
|
(<span class="since">Since 6.5.0</span>)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
define persistent mediated devices
|
||||||
|
(<span class="since">Since 7.3.0</span>)
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Because mediated devices are instantiated from vendor specific templates,
|
Because mediated devices are instantiated from vendor specific templates,
|
||||||
simply called 'types', information describing these types is contained
|
simply called 'types', information describing these types is contained
|
||||||
within the parent device's capabilities
|
within the parent device's capabilities (see the example in <a
|
||||||
(see the example in <a href="#PCI">PCI host devices</a>).
|
href="#PCI">PCI host devices</a>). To list all devices capable of
|
||||||
|
creating mediated devices, the following command can be used.
|
||||||
</p>
|
</p>
|
||||||
|
<pre>$ virsh nodedev-list --cap mdev_types</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To see the supported mediated device types on a specific physical device
|
To see the supported mediated device types on a specific physical device
|
||||||
use the following:
|
use the following:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>$ virsh nodedev-dumpxml <device></pre>
|
||||||
$ ls /sys/class/mdev_bus/<device>/mdev_supported_types</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Before creating a mediated device, unbind the device from the respective
|
Before creating a mediated device, unbind the device from the respective
|
||||||
@ -252,22 +275,40 @@ echo $subchannel > /sys/bus/css/drivers/vfio_ccw/bind
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To manually instantiate a mediated device, use one of the following as a
|
To instantiate a transient mediated device, create an XML file representing the
|
||||||
reference. For a CCW device, use the subchannel ID instead of the device
|
device. See above for information about the mediated device xml format.
|
||||||
ID.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>$ virsh nodedev-create <xml-file>
|
||||||
$ uuidgen > /sys/class/mdev_bus/<device>/mdev_supported_types/<type>/create
|
Node device '<device-name>' created from '<xml-file>'</pre>
|
||||||
...
|
|
||||||
$ echo <UUID> > /sys/class/mdev_bus/<device>/mdev_supported_types/<type>/create</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Manual removal of a mediated device is then performed as follows:
|
If you would like to persistently define the device so that it will be
|
||||||
|
maintained across host reboots, use <code>virsh nodedev-define</code>
|
||||||
|
instead of <code>nodedev-create</code>:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>$ virsh nodedev-define <xml-file>
|
||||||
$ echo 1 > /sys/bus/mdev/devices/<uuid>/remove</pre>
|
Node device '<device-name>' defined from '<xml-file>'</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
To start an instance of this device definition, use the following command:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>$ virsh nodedev-start <device-name></pre>
|
||||||
|
<p>
|
||||||
|
Active mediated device instances can be stopped using <code>virsh
|
||||||
|
nodedev-destroy</code>, and persistent device definitions can be removed
|
||||||
|
using <code>virsh nodedev-undefine</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
If a mediated device is defined persistently, it can also be set to be
|
||||||
|
automatically started whenever the host reboots or when the parent device
|
||||||
|
becomes available. In order to autostart a mediated device, use the
|
||||||
|
following command:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>$ virsh nodedev-autostart <device-name></pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user