]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
PCI: pciehp: Wait for hotplug command completion where necessary
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 8 Jun 2015 23:10:50 +0000 (17:10 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jun 2015 15:46:29 +0000 (10:46 -0500)
commita5dd4b4b0570b3bf880d563969b245dfbd170c1e
tree72e841a8152a57cf125853bd661cf3bae156e763
parent0824965140fff1bf640a987dc790d1594a8e0699
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: 3461a068661c ("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+
drivers/pci/hotplug/pciehp_hpc.c