Yesterday for the first time I consciously noticed the
virNodeDeviceDettach and virNodeDeviceReAttach APIs, and found that they
are hardcoded to bind to/unbind from the pci-stub driver for qemu, and
the "pciback" driver for Xen. If we want these APIs to be useful for
VFIO, they will need to bind to the vfio driver instead, but there is
currently no method in those APIs to specify which driver to bind to.
I guess we could do this with new virNodeDeviceDetachFlags() and
virNodeDeviceReAttachFlags() APIs which have a flag to indicate vfio,
but before going to that trouble I'd like to know if these APIs are
actually used or if they are deprecated (they don't seem to be of any
use if the hostdev devices you're assigning have "managed='yes'" -
as
far as I can see, setting managed='yes' just makes the bind/unbind from
the stub driver an automatic part of assigning/un-assigning the device
to a guest).
(Beyond that, this would be exposing a lower level of detail in the APIs
than the original functions, and I'm not sure if it's appropriate - the
choice of stub driver was previously hidden in each hypervisor driver).