kernel_optimize_test/Documentation/PCI
Oza Pawandeep 7e9084b367 PCI/AER: Handle ERR_FATAL with removal and re-enumeration of devices
PCIe ERR_FATAL errors mean the Link is unreliable.  Components on the Link
may need to be reset to return to reliable operation (PCIe r4.0, sec
6.2.2).  We previously handled these errors much differently depending on
whether the platform supports Downstream Port Containment (DPC) (PCIe r4.0,
sec 6.2.10) or not.

The AER driver has historically logged the error details, called
driver-supplied pci_error_handlers callbacks, and reset the Link.  This
reset downstream devices, but did not remove them from the PCI subsystem,
re-enumerate them, or call their driver .remove() or .probe() methods.

DPC is different because the hardware automatically disables the Link when
it detects ERR_FATAL, which resets downstream devices.  There's no
opportunity for pci_error_handlers callbacks before resetting the Link.
The DPC driver removes affected devices (which calls their driver .remove()
methods), brings the Link back up, and re-enumerates (which calls driver
.probe() methods).

Align AER ERR_FATAL handling with DPC by resetting the Link in software,
skipping the driver pci_error_handlers callbacks, removing the devices from
the PCI subsystem, and re-enumerating.  The idea is that drivers and
devices should see the same behavior for ERR_FATAL events, regardless of
whether they're handled by AER or DPC.

Here are the basic ERR_FATAL recovery steps, showing the previous AER
behavior, the AER behavior after this patch, and the DPC behavior:

                          AER        AER      DPC
                          previous   new      behavior
                          --------   ---      --------
  Log error               yes        yes      yes (minimal)
  drv.error_detected()    yes        no       no
  Reset Link              yes        yes      yes
  drv.mmio_enabled()      yes        no       no
  drv.slot_reset()        yes        no       no
  drv.resume()            yes        no       no
  Remove PCI devices      no         yes      yes
    (calls drv.remove())
  Re-enumerate            no         yes      yes
    (calls drv.probe())

N.B. With DPC, the Link reset happens before the driver .remove() calls,
while with AER, the reset happens *after* the .remove() calls.  The goal is
to eventually do the reset before .remove() for AER as well.

Signed-off-by: Oza Pawandeep <poza@codeaurora.org>
[bhelgaas: changelog, squash doc patch into this, remove unused
"result_data"]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
2018-05-17 16:44:13 -05:00
..
endpoint Documentation: PCI: Add userguide for PCI endpoint test function 2017-04-28 10:23:20 -05:00
00-INDEX Documentation: PCI: Add userguide for PCI endpoint test function 2017-04-28 10:23:20 -05:00
MSI-HOWTO.txt docs: update old references for DocBook from the documentation 2017-05-16 08:44:19 -03:00
pci-error-recovery.txt PCI/AER: Handle ERR_FATAL with removal and re-enumeration of devices 2018-05-17 16:44:13 -05:00
pci-iov-howto.txt PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding 2017-04-20 08:53:51 -05:00
pci.txt PCI: Update location of pci.ids file 2018-02-22 15:00:43 -06:00
pcieaer-howto.txt pcieaer doc: update the link 2017-03-03 15:50:00 -07:00
PCIEBUS-HOWTO.txt PCI/MSI: Update MSI/MSI-X bits in PCIEBUS-HOWTO 2017-02-15 11:51:33 -06:00