mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: support manually specifying VFIO variant driver in <hostdev> XML
This patch makes it possible to manually specify which VFIO variant driver to use for PCI hostdev device assignment, so that, e.g. you could force use of a VFIO "variant" driver, with e.g. <driver model='mlx5_vfio_pci'/> or alternately to force use of the generic vfio-pci driver with <driver model='vfio-pci'/> when libvirt would have normally (after applying a subsequent patch) found a "better match" for a device in the active kernel's modules.alias file. (The main potential use of this manual override would probably be to work around a bug in a new VFIO variant driver by temporarily not using that driver). Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
@@ -4508,17 +4508,39 @@ or:
|
||||
an error. See the `Device Addresses`_ section for more details on the address
|
||||
element.
|
||||
``driver``
|
||||
PCI devices can have an optional ``driver`` subelement that specifies which
|
||||
backend driver to use for PCI device assignment. Use the ``name`` attribute
|
||||
to select either "vfio" (for the new VFIO device assignment backend, which is
|
||||
compatible with UEFI SecureBoot) or "kvm" (the legacy device assignment
|
||||
handled directly by the KVM kernel module) :since:`Since 1.0.5 (QEMU and KVM
|
||||
only, requires kernel 3.6 or newer)` . When specified, device assignment will
|
||||
fail if the requested method of device assignment isn't available on the
|
||||
host. When not specified, the default is "vfio" on systems where the VFIO
|
||||
driver is available and loaded, and "kvm" on older systems, or those where
|
||||
the VFIO driver hasn't been loaded :since:`Since 1.1.3` (prior to that the
|
||||
default was always "kvm").
|
||||
PCI hostdev devices can have an optional ``driver`` subelement that
|
||||
specifies which host driver to bind to the device when preparing it
|
||||
for assignment to a guest. :since:`Since 10.0.0 (useful for QEMU and
|
||||
KVM only)`. This is done by setting the ``<driver>`` element's ``model``
|
||||
attribute, for example::
|
||||
|
||||
...
|
||||
<hostdev mode='subsystem' type='pci' managed='yes'>
|
||||
<driver model='vfio-pci-igb'/>
|
||||
...
|
||||
|
||||
tells libvirt to bind the driver "vfio-pci-igb" to the device on
|
||||
the host before handing it off to QEMU for assignment to the
|
||||
guest. Normally libvirt will bind the device to the "best match"
|
||||
VFIO-type driver that it finds in the kernel's modules.alias file
|
||||
(based on matching the corresponding fields of the device's
|
||||
modalias file in sysfs) or to the generic "vfio-pci" driver if no
|
||||
better match is found (vfio-pci is always used prior to libvirt
|
||||
10.0.0), but in cases when the correct driver isn't listed in
|
||||
modules.alias then the desired device-specific driver can be forced
|
||||
by setting driver name, or if the device-specific driver that is
|
||||
found is "problematic" in some way, the generic vfio-pci driver
|
||||
similarly be forced.
|
||||
|
||||
(Note: :since:`Since 1.0.5, the ``name`` attribute has been
|
||||
described to be used to select the type of PCI device assignment
|
||||
("vfio", "kvm", or "xen"), but those values have been mostly
|
||||
useless, since the type of device assignment is actually determined
|
||||
by which hypservisor is in use. This means that you may
|
||||
occasionally see ``<driver name='vfio'/>`` or ``<driver
|
||||
name='xen'/>`` in a domain's status XML, or more rarely in config,
|
||||
but those specific values are essentially ignored.)
|
||||
|
||||
``readonly``
|
||||
Indicates that the device is readonly, only supported by SCSI host device
|
||||
now. :since:`Since 1.0.6 (QEMU and KVM only)`
|
||||
|
||||
@@ -315,17 +315,14 @@ to the physical LAN (if at all).
|
||||
guest, use the traditional ``<hostdev>`` device definition. :since:` Since
|
||||
0.10.0`
|
||||
|
||||
To force use of a particular type of device assignment, a <forward
|
||||
type='hostdev'> interface can have an optional ``driver`` sub-element with
|
||||
a ``name`` attribute set to either "vfio" (VFIO is a new method of device
|
||||
assignment that is compatible with UEFI Secure Boot) or "kvm" (the legacy
|
||||
device assignment handled directly by the KVM kernel module) :since:`Since
|
||||
1.0.5 (QEMU and KVM only, requires kernel 3.6 or newer)` . When specified,
|
||||
device assignment will fail if the requested method of device assignment
|
||||
isn't available on the host. When not specified, the default is "vfio" on
|
||||
systems where the VFIO driver is available and loaded, and "kvm" on older
|
||||
systems, or those where the VFIO driver hasn't been loaded :since:`Since
|
||||
1.1.3` (prior to that the default was always "kvm").
|
||||
To force use of a particular device-specific VFIO driver when
|
||||
assigning the devices to a guest, a <forward type='hostdev'>
|
||||
interface can have an optional ``driver`` sub-element with a
|
||||
``model`` attribute set to the name of the driver to use
|
||||
:since:`Since 10.0.0 (QEMU only)`. When not specified, libvirt
|
||||
will attempt to find a suitable VFIO variant driver for the
|
||||
device, and if not found it will use the generic driver
|
||||
"vfio-pci".
|
||||
|
||||
Note that this "intelligent passthrough" of network devices is very
|
||||
similar to the functionality of a standard ``<hostdev>`` device, the
|
||||
|
||||
Reference in New Issue
Block a user