linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] PCI: Add support for resetting the slots in a platform specific way
@ 2025-04-04  8:22 Manivannan Sadhasivam via B4 Relay
  2025-04-04  8:22 ` [PATCH 1/4] PCI/ERR: Remove misleading TODO regarding kernel panic Manivannan Sadhasivam via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2025-04-04  8:22 UTC (permalink / raw)
  To: Mahesh J Salgaonkar, Oliver O'Halloran, Bjorn Helgaas,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring
  Cc: dingwei, cassel, Krishna Chaitanya Chundru, linuxppc-dev,
	linux-pci, linux-kernel, linux-arm-msm, Manivannan Sadhasivam

Hi,

Currently, in the event of AER/DPC, PCI core will try to reset the slot and its
subordinate devices by invoking bridge control reset and FLR. But in some
cases like AER Fatal error, it might be necessary to reset the slots using the
PCI host bridge drivers in a platform specific way (as indicated by the TODO in
the pcie_do_recovery() function in drivers/pci/pcie/err.c). Otherwise, the PCI
link won't be recovered successfully.

So this series adds a new callback 'pci_host_bridge::reset_slot' for the host
bridge drivers to reset the slot when a fatal error happens.

Also, this series allows the host bridge drivers to handle PCI link down event
by resetting the slots and recovering the bus. This is accomplished by the
help of a new API 'pci_host_handle_link_down()'. Host bridge drivers are
expected to call this API (preferrably from a threaded IRQ handler) when a link
down event is detected. The API will reuse the pcie_do_recovery() function to
recover the link if AER support is enabled, otherwise it will directly call the
reset_slot() callback of the host bridge driver (if exists).

For reference, I've modified the pcie-qcom driver to call
pci_host_handle_link_down() after receiving LINK_DOWN global_irq event and
populated the 'pci_host_bridge::reset_slot()' callback to reset the controller
(there by slots). Since the Qcom PCIe controllers support only a single root
port (slot) per controller instance, reset_slot() callback is going to be
invoked only once. For multi root port controllers, this callback is supposed to
identify the slots using the supplied 'pci_dev' pointer and reset them.

NOTE
====

This series is a reworked version of the earlier series [1] that I submitted for
handling PCI link down event. In this series, I've made use of the AER helpers
to recover the link as it allows notifying the device drivers and also
allows saving/restoring the config space.

Testing
=======

This series is tested on Qcom RB5 and SA8775p Ride boards by triggering the link
down event manually by writing to LTSSM register. For the error recovery to
succeed (if AER is enabled), all the drivers in the bridge hierarchy should have
the 'err_handlers' populated. Otherwise, the link recovery will fail.

[1] https://lore.kernel.org/linux-pci/20250221172309.120009-1-manivannan.sadhasivam@linaro.org

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Manivannan Sadhasivam (4):
      PCI/ERR: Remove misleading TODO regarding kernel panic
      PCI/ERR: Add support for resetting the slot in a platforms specific way
      PCI: Add link down handling for host bridges
      PCI: qcom: Add support for resetting the slot due to link down event

 drivers/pci/controller/dwc/pcie-qcom.c | 89 +++++++++++++++++++++++++++++++++-
 drivers/pci/pci.h                      | 22 +++++++++
 drivers/pci/pcie/err.c                 | 29 ++++++++---
 drivers/pci/probe.c                    |  7 +++
 include/linux/pci.h                    |  2 +
 5 files changed, 140 insertions(+), 9 deletions(-)
---
base-commit: 08733088b566b58283f0f12fb73f5db6a9a9de30
change-id: 20250404-pcie-reset-slot-730bfa71a202

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-04-17 11:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04  8:22 [PATCH 0/4] PCI: Add support for resetting the slots in a platform specific way Manivannan Sadhasivam via B4 Relay
2025-04-04  8:22 ` [PATCH 1/4] PCI/ERR: Remove misleading TODO regarding kernel panic Manivannan Sadhasivam via B4 Relay
2025-04-04  8:22 ` [PATCH 2/4] PCI/ERR: Add support for resetting the slot in a platforms specific way Manivannan Sadhasivam via B4 Relay
2025-04-04  8:46   ` Lukas Wunner
2025-04-15 13:33     ` Manivannan Sadhasivam
2025-04-16 14:38       ` Lukas Wunner
2025-04-16 15:04         ` Manivannan Sadhasivam
2025-04-17  0:23           ` Lukas Wunner
2025-04-17  5:39             ` Manivannan Sadhasivam
2025-04-17 11:42               ` Lukas Wunner
2025-04-04  8:22 ` [PATCH 3/4] PCI: Add link down handling for host bridges Manivannan Sadhasivam via B4 Relay
2025-04-04  8:22 ` [PATCH 4/4] PCI: qcom: Add support for resetting the slot due to link down event Manivannan Sadhasivam via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).