linux/drivers/pci/hotplug
Alex Williamson a5dd4b4b05 PCI: pciehp: Wait for hotplug command completion where necessary
The commit referenced below deferred waiting for command completion until
the start of the next command, allowing hardware to do the latching
asynchronously.  Unfortunately, being ready to accept a new command is the
only indication we have that the previous command is completed.  In cases
where we need that state change to be enabled, we must still wait for
completion.  For instance, pciehp_reset_slot() attempts to disable anything
that might generate a surprise hotplug on slots that support presence
detection.  If we don't wait for those settings to latch before the
secondary bus reset, we negate any value in attempting to prevent the
spurious hotplug.

Create a base function with optional wait and helper functions so that
pcie_write_cmd() turns back into the "safe" interface which waits before
and after issuing a command and add pcie_write_cmd_nowait(), which
eliminates the trailing wait for asynchronous completion.  The following
functions are returned to their previous behavior:

  pciehp_power_on_slot
  pciehp_power_off_slot
  pcie_disable_notification
  pciehp_reset_slot

The rationale is that pciehp_power_on_slot() enables the link and therefore
relies on completion of power-on.  pciehp_power_off_slot() and
pcie_disable_notification() need a wait because data structures may be
freed after these calls and continued signaling from the device would be
unexpected.  And, of course, pciehp_reset_slot() needs to wait for the
scenario outlined above.

Fixes: 3461a06866 ("PCI: pciehp: Wait for hotplug command completion lazily")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org	# v3.17+
2015-06-09 10:46:29 -05:00
..
acpi_pcihp.c Merge branches 'pci/enumeration', 'pci/virtualization' and 'pci/cleanup' into next 2014-09-25 13:52:02 -06:00
acpiphp.h ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges 2014-06-11 21:08:49 +02:00
acpiphp_core.c PCI: Move EXPORT_SYMBOL so it immediately follows function/variable 2014-06-10 13:36:10 -06:00
acpiphp_glue.c ACPI / hotplug / PCI: Check ignore_hotplug for all downstream devices 2015-05-22 17:38:50 -05:00
acpiphp_ibm.c PCI: Add space before open parenthesis 2014-09-24 07:43:03 -06:00
cpci_hotplug.h PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpci_hotplug_core.c PCI: Delete unnecessary NULL pointer checks 2014-12-26 16:28:08 -07:00
cpci_hotplug_pci.c PCI: cpcihp: Add missing curly braces in cpci_configure_slot() 2015-03-12 11:22:10 -05:00
cpcihp_generic.c PCI: Add space before open parenthesis 2014-09-24 07:43:03 -06:00
cpcihp_zt5550.c PCI: Remove assignment from "if" conditions 2014-09-24 07:50:53 -06:00
cpcihp_zt5550.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
cpqphp.h PCI: Add space before open parenthesis 2014-09-24 07:43:03 -06:00
cpqphp_core.c PCI: Remove unnecessary curly braces 2014-09-24 07:49:20 -06:00
cpqphp_ctrl.c PCI: Remove unnecessary curly braces 2014-09-24 07:49:20 -06:00
cpqphp_nvram.c PCI: Remove unnecessary curly braces 2014-09-24 07:49:20 -06:00
cpqphp_nvram.h PCI: Remove "extern" from function declarations 2013-04-17 10:21:17 -06:00
cpqphp_pci.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
cpqphp_sysfs.c PCI: cpqphp: Remove unnecessary null test before debugfs_remove() 2014-07-07 14:53:44 -06:00
ibmphp.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
ibmphp_core.c PCI: Assign resources before drivers claim devices (pci_scan_bus()) 2015-03-12 15:04:01 -05:00
ibmphp_ebda.c PCI: Remove unnecessary curly braces 2014-09-24 07:49:20 -06:00
ibmphp_hpc.c PCI: Remove unnecessary curly braces 2014-09-24 07:49:20 -06:00
ibmphp_pci.c PCI: Remove assignment from "if" conditions 2014-09-24 07:50:53 -06:00
ibmphp_res.c PCI: Simplify if-return sequences 2014-11-10 21:08:07 -07:00
Kconfig PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
Makefile PCI: pciehp: Drop pointless ACPI-based "slot detection" check 2015-05-21 11:01:12 -05:00
pci_hotplug_core.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
pciehp.h PCI: pciehp: Drop pointless ACPI-based "slot detection" check 2015-05-21 11:01:12 -05:00
pciehp_core.c PCI: pciehp: Drop pointless label from pciehp_probe() 2015-05-22 17:38:47 -05:00
pciehp_ctrl.c PCI: pciehp: Handle surprise add even if surprise removal isn't supported 2015-01-21 10:28:07 -06:00
pciehp_hpc.c PCI: pciehp: Wait for hotplug command completion where necessary 2015-06-09 10:46:29 -05:00
pciehp_pci.c PCI: pciehp: Remove pci_configure_slot() usage 2014-09-12 20:09:47 -06:00
pcihp_skeleton.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
rpadlpar.h PCI: Remove "extern" from function declarations 2013-04-17 10:21:17 -06:00
rpadlpar_core.c powerpc/eeh: Do probe on pci_dn 2015-03-24 13:15:52 +11:00
rpadlpar_sysfs.c PCI: introduce pci_slot 2008-06-10 14:37:03 -07:00
rpaphp.h PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
rpaphp_core.c of: Migrate of_find_node_by_name() users to for_each_node_by_name() 2014-06-26 17:12:24 +01:00
rpaphp_pci.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
rpaphp_slot.c PCI: Fix whitespace, capitalization, and spelling errors 2013-11-14 11:28:18 -07:00
s390_pci_hpc.c s390/pci: fix kmsg component 2014-07-22 09:26:21 +02:00
sgi_hotplug.c ACPI: Introduce acpi_unload_parent_table() usages in Linux kernel 2015-01-26 16:08:49 +01:00
shpchp.h PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00
shpchp_core.c PCI: Merge multi-line quoted strings 2014-06-10 20:20:42 -06:00
shpchp_ctrl.c PCI: Remove assignment from "if" conditions 2014-09-24 07:50:53 -06:00
shpchp_hpc.c PCI: Remove assignment from "if" conditions 2014-09-24 07:50:53 -06:00
shpchp_pci.c PCI: shpchp: Remove pci_configure_slot() usage 2014-09-12 20:09:49 -06:00
shpchp_sysfs.c PCI: Whitespace cleanup 2014-06-10 20:20:19 -06:00