]> git.ipfire.org Git - thirdparty/libvirt.git/commit
node_device: support binding other drivers with virNodeDeviceDetachFlags()
authorLaine Stump <laine@redhat.com>
Sun, 9 Jul 2023 04:37:45 +0000 (00:37 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 25 Aug 2023 03:36:18 +0000 (23:36 -0400)
commit24beaffec33efa3fa077d7b8596d97aa9a038a01
tree618e4fb2b558d3a4c01344f9cc3afee2e22985b0
parent928296b044647fd3cbe409db6903afc791863a90
node_device: support binding other drivers with virNodeDeviceDetachFlags()

In the past, the only allowable values for the "driver" field of
virNodeDeviceDetachFlags() were "kvm" or "vfio" for the QEMU driver,
and "xen" for the libxl driver. Then "kvm" was deprecated and removed,
so the driver name became essentially irrelevant (because it is always
called via a particular hypervisor driver, and so the "xen" or "vfio"
can be (and almost always is) implied.

With the advent of VFIO variant drivers, the ability to explicitly
specify a driver name once again becomes useful - it can be used to
name the exact VFIO driver that we want bound to the device in place
of vfio-pci, so this patch allows those other names to be passed down
the call chain, where the code in virpci.c can make use of them.

The names "vfio", "kvm", and "xen" retain their special meaning, though:

  1) because there may be some application or configuration that still
     calls virNodeDeviceDetachFlags() with driverName="vfio", this
     single value is substituted with the synonym of NULL, which means
     "bind the default driver for this device and hypervisor". This
     will currently result in the vfio-pci driver being bound to the
     device.

  2) in the case of the libxl driver, "xen" means to use the standard
     driver used in the case of Xen ("pciback").

  3) "kvm" as a driver name always results in an error, as legacy KVM
     device assignment was removed from the kernel around 10 years ago.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hypervisor/domain_driver.c
src/hypervisor/domain_driver.h
src/libxl/libxl_driver.c
src/qemu/qemu_driver.c