linux/drivers/pci/pcie
Stanislaw Gruszka 002bf2fbc0 PCI/AER: Block runtime suspend when handling errors
PM runtime can be done simultaneously with AER error handling.  Avoid that
by using pm_runtime_get_sync() before and pm_runtime_put() after reset in
pcie_do_recovery() for all recovering devices.

pm_runtime_get_sync() will increase dev->power.usage_count counter to
prevent any possible future request to runtime suspend a device.  It will
also resume a device, if it was previously in D3hot state.

I tested with igc device by doing simultaneous aer_inject and rpm
suspend/resume via /sys/bus/pci/devices/PCI_ID/power/control and can
reproduce:

  igc 0000:02:00.0: not ready 65535ms after bus reset; giving up
  pcieport 0000:00:1c.2: AER: Root Port link has been reset (-25)
  pcieport 0000:00:1c.2: AER: subordinate device reset failed
  pcieport 0000:00:1c.2: AER: device recovery failed
  igc 0000:02:00.0: Unable to change power state from D3hot to D0, device inaccessible

The problem disappears when this patch is applied.

Link: https://lore.kernel.org/r/20240212120135.146068-1-stanislaw.gruszka@linux.intel.com
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Cc: <stable@vger.kernel.org>
2024-03-07 17:58:07 -06:00
..
aer_inject.c PCI/AER: Update aer-inject URL 2022-03-02 11:26:17 -06:00
aer.c PCI/AER: Use explicit register sizes for struct members 2024-01-02 16:51:39 -06:00
aspm.c arm64 updates for 6.8 2024-01-08 16:32:09 -08:00
dpc.c PCI/DPC: Use defines with DPC reason fields 2023-10-24 10:54:04 -05:00
edr.c PCI/EDR: Add edr_handle_event() comments 2023-04-07 17:39:53 -05:00
err.c PCI/AER: Block runtime suspend when handling errors 2024-03-07 17:58:07 -06:00
Kconfig PCI/AER: Forward RCH downstream port-detected errors to the CXL.mem dev handler 2023-10-27 20:13:39 -07:00
Makefile PCI/portdrv: Squash into portdrv.c 2022-10-24 14:57:30 -05:00
pme.c PCI/PME: Use FIELD_GET() 2023-10-24 16:55:45 -05:00
portdrv.c PCI/portdrv: Use FIELD_GET() 2023-10-24 16:55:45 -05:00
portdrv.h PCI/AER: Export pcie_aer_is_native() 2023-09-11 15:24:16 -07:00
ptm.c PCI/PTM: Use FIELD_GET() 2023-10-24 16:55:45 -05:00
rcec.c PCI/RCEC: Fix RCiEP device to RCEC association 2021-03-10 15:10:46 -06:00