PCI: Add pci_reset_slot() and pci_reset_bus()
authorAlex Williamson <alex.williamson@redhat.com>
Thu, 8 Aug 2013 20:09:55 +0000 (14:09 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 14 Aug 2013 21:20:37 +0000 (15:20 -0600)
commit090a3c5322e900f468b3205b76d0837003ad57b2
tree8363cd8326137b871778fac3e2f2c32bb0a13f31
parent77cb985ad4acbe66a92ead1bb826deffa47dd33f
PCI: Add pci_reset_slot() and pci_reset_bus()

Sometimes pci_reset_function() is not sufficient.  We have cases where
devices do not support any kind of reset, but there might be multiple
functions on the bus preventing pci_reset_function() from doing a
secondary bus reset.  We also have cases where a device will advertise
that it supports a PM reset, but really does nothing on D3hot->D0
(graphics cards are notorious for this).  These devices often also
have more than one function, so even blacklisting PM reset for them
wouldn't allow a secondary bus reset through pci_reset_function().

If a driver supports multiple devices it should have the ability to
induce a bus reset when it needs to.  This patch provides that ability
through pci_reset_slot() and pci_reset_bus().  It's the caller's
responsibility when using these interfaces to understand that all of
the devices in or below the slot (or on or below the bus) will be
reset and therefore should be under control of the caller.  PCI state
of all the affected devices is saved and restored around these resets,
but internal state of all of the affected devices is reset (which
should be the intention).

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c
include/linux/pci.h