]> git.ipfire.org Git - thirdparty/libvirt.git/commit
pci: autolearn name of stub driver, remove from arglist
authorLaine Stump <laine@laine.org>
Wed, 1 May 2013 18:44:10 +0000 (14:44 -0400)
committerLaine Stump <laine@laine.org>
Thu, 2 May 2013 06:09:29 +0000 (02:09 -0400)
commite482693b24de7b57531d9b3ac75dc1b3bb05a4cd
tree6e3b4a170b6644e865d1c1bc9935551fa849207c
parente2472e6957b4eb330e62ebdc293d3ec37d858e71
pci: autolearn name of stub driver, remove from arglist

virPCIDeviceReattach and virPCIDeviceUnbindFromStub (called by
virPCIDeviceReattach) had previously required the name of the stub
driver as input. This is unnecessary, because the name of the driver
the device is currently bound to can be found by looking at the link:

  /sys/bus/pci/dddd:bb:ss.ff/driver

Instead of requiring that the name of the expected stub driver name
and only unbinding if that one name is matched, we no longer take a
driver name in the arglist for either of these
functions. virPCIDeviceUnbindFromStub just compares the name of the
currently bound driver to a list of "well known" stubs (right now
contains "pci-stub" and "vfio-pci" for qemu, and "pciback" for xen),
and only performs the unbind if it's one of those devices.

This allows virsh nodedevice-reattach to work properly across a
libvirtd restart, and fixes a couple of cases where we were
erroneously still hard-coding "pci-stub" as the drive name.

For some unknown reason, virPCIDeviceReattach had been calling
modprobe on the stub driver prior to unbinding the device. This was
problematic because we no longer know the name of the stub driver in
that function. However, it is pointless to probe for the stub driver
at that time anyway - because the device is bound to the stub driver,
we are guaranteed that it is already loaded, and so that call to
modprobe has been removed.
src/qemu/qemu_driver.c
src/qemu/qemu_hostdev.c
src/util/virpci.c
src/util/virpci.h
src/xen/xen_driver.c