]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virpci: support driver_override sysfs interface
authorJim Fehlig <jfehlig@suse.com>
Tue, 2 Aug 2016 03:36:45 +0000 (21:36 -0600)
committerJim Fehlig <jfehlig@suse.com>
Fri, 2 Sep 2016 17:47:23 +0000 (11:47 -0600)
commit70f83f9d526e4c7d76c0333b125d8e44bc5754bd
tree02507a59c6db7682b01b9a01b55da2b9d2460764
parente01d300bb1b2185536c81858e4e707e1f16a4c9e
virpci: support driver_override sysfs interface

libvirt uses the new_id PCI sysfs interface to bind a PCI stub driver
to a PCI device. The new_id interface is known to be buggy and racey,
hence a more deterministic interface was introduced in the 3.12 kernel:
driver_override. For more details see

https://www.redhat.com/archives/libvir-list/2016-June/msg02124.html

For more details about the driver_override interface and examples of
its usage, see

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/pci/pci-driver.c?h=v3.12&id=782a985d7af26db39e86070d28f987cad21313c0

This patch adds support for the driver_override interface by

- adding new virPCIDevice{BindTo,UnbindFrom}StubWithOverride functions
  that use the driver_override interface
- renames the existing virPCIDevice{BindTo,UnbindFrom}Stub functions
  to virPCIDevice{BindTo,UnbindFrom}StubWithNewid to perserve existing
  behavior on new_id interface
- changes virPCIDevice{BindTo,UnbindFrom}Stub function to call one of
  the above depending on availability of driver_override

The patch includes a bit of duplicate code, but allows for easily
dropping the new_id code once support for older kernels is no
longer desired.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/util/virpci.c