linux-sg2042/drivers/pci
Alex Williamson 16b6c8bb68 PCI: Detach driver before procfs & sysfs teardown on device remove
When removing a device, for example a VF being removed due to SR-IOV
teardown, a "soft" hot-unplug via 'echo 1 > remove' in sysfs, or an actual
hot-unplug, we first remove the procfs and sysfs attributes for the device
before attempting to release the device from any driver bound to it.
Unbinding the driver from the device can take time.  The device might need
to write out data or it might be actively in use.  If it's in use by
userspace through a vfio driver, the unbind might block until the user
releases the device.  This leads to a potentially non-trivial amount of
time where the device exists, but we've torn down the interfaces that
userspace uses to examine devices, for instance lspci might generate this
sort of error:

  pcilib: Cannot open /sys/bus/pci/devices/0000:01:0a.3/config
  lspci: Unable to read the standard configuration space header of device 0000:01:0a.3

We don't seem to have any dependence on this teardown ordering in the
kernel, so let's unbind the driver first, which is also more symmetric with
the instantiation of the device in pci_bus_add_device().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2017-10-25 08:47:10 -05:00
..
dwc Merge branch 'pci/trivial' into next 2017-09-07 13:24:20 -05:00
endpoint PCI: endpoint: Use correct "end of test" interrupt 2017-09-20 13:56:06 -05:00
host pci-v4.14-changes 2017-09-08 15:47:43 -07:00
hotplug Merge branch 'pci/misc' into next 2017-09-07 13:24:16 -05:00
pcie dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
switch Merge branch 'pci/switchtec' into next 2017-07-02 18:51:10 -05:00
Kconfig PCI: Add Kconfig PCI_IOV dependency for PCI_REALLOC_ENABLE_AUTO 2017-10-05 15:54:58 -05:00
Makefile PCI: Build setup-irq.o on all arches 2017-07-02 16:14:27 -05:00
access.c PCI: Provide Kconfig option for lockless config space accessors 2017-06-28 22:32:56 +02:00
ats.c PCI: Restore PRI and PASID state after Function-Level Reset 2017-05-30 15:40:50 -05:00
bus.c PCI: Autosense device removal in pci_bridge_d3_update() 2016-11-17 18:44:56 -06:00
ecam.c PCI: ECAM: Map config region with pci_remap_cfgspace() 2017-04-24 13:53:14 -05:00
host-bridge.c cxl: use pcibios_free_controller_deferred() when removing vPHBs 2016-08-22 11:09:33 +10:00
hotplug-pci.c
htirq.c
iov.c PCI: Restore ARI Capable Hierarchy before setting numVFs 2017-10-10 19:15:29 -05:00
irq.c pci-v4.12-changes 2017-05-08 19:03:25 -07:00
mmap.c PCI: Add I/O BAR support to generic pci_mmap_resource_range() 2017-04-20 08:47:47 -05:00
msi.c pci-v4.14-changes 2017-09-08 15:47:43 -07:00
of.c PCI/MSI: Use of_msi_get_domain instead of open-coded "msi-parent" parsing 2015-10-16 13:07:14 +01:00
pci-acpi.c ACPI / PCI / PM: Rework acpi_pci_propagate_wakeup() 2017-08-01 14:05:03 +02:00
pci-driver.c ACPI updates for v4.14-rc1 2017-09-05 12:45:03 -07:00
pci-label.c PCI: Constify label attribute_group structures 2017-08-10 15:21:41 -05:00
pci-mid.c PCI / PM: Simplify device wakeup settings code 2017-06-28 01:52:45 +02:00
pci-stub.c
pci-sysfs.c PCI: Expose SR-IOV offset, stride, and VF device ID via sysfs 2017-10-10 19:12:12 -05:00
pci.c PCI: Remove unused function __pci_reset_function() 2017-10-05 15:54:57 -05:00
pci.h PCI: Cache the VF device ID in the SR-IOV structure 2017-10-05 15:54:58 -05:00
probe.c pci-v4.14-changes 2017-09-08 15:47:43 -07:00
proc.c PCI: Add BAR index argument to pci_mmap_page_range() 2017-04-20 08:47:47 -05:00
quirks.c PCI: Apply Cavium ThunderX ACS quirk to more Root Ports 2017-10-19 13:28:16 -05:00
remove.c PCI: Detach driver before procfs & sysfs teardown on device remove 2017-10-25 08:47:10 -05:00
rom.c PCI: Add comments about ROM BAR updating 2016-11-29 18:05:09 -06:00
search.c PCI: Add device flag PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT 2017-04-13 18:49:50 -05:00
setup-bus.c PCI: Fix calculation of bridge window's size and alignment 2017-04-18 14:47:20 -05:00
setup-irq.c PCI: Inline and remove pcibios_update_irq() 2017-08-10 12:49:57 -05:00
setup-res.c PCI: Add a generic weak pcibios_align_resource() 2017-08-02 14:53:16 -05:00
slot.c locking/atomic, kref: Add kref_read() 2017-01-14 11:37:18 +01:00
syscall.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
vc.c PCI: Fix unaligned accesses in VC code 2016-06-20 13:24:20 -05:00
vpd.c
xen-pcifront.c xen: make use of xenbus_read_unsigned() in xen-pcifront 2016-11-07 13:55:26 +01:00