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:
Laine Stump
2024-01-04 20:12:51 -05:00
parent 956e1ca6aa
commit 8b93d78c83
17 changed files with 138 additions and 33 deletions

View File

@@ -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