Skip to content

PCI: dw-rockchip: Add support to reset Root Port upon link down event

Niklas Cassel linux-pci linux-rockchip 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/1PCI: dw-rockchip: Add support to reset Root Port upon link down eventdrivers/pci/controller/dwc/Kconfig drivers/pci/controller/dwc/pcie-dw-rockchip.c+132 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] PCI: dw-rockchip: Add support to reset Root Port upon link down event

Hello all,

This depends on Mani's v8 series with adds a reset_root_port() callback:
https://lore.kernel.org/linux-pci/[email protected]/

Tested by using two Rock 5B boards and simulating a link down by doing:
echo 0 > /sys/kernel/config/pci_ep/controllers/a40000000.pcie-ep/start && \
sleep 0.1 && echo 1 > /sys/kernel/config/pci_ep/controllers/a40000000.pcie-ep/start on the board running in EP mode.

We can see the root port being recovered on the host side after the link down:
pcieport 0000:00:00.0: Recovering Root Port due to Link Down rockchip-dw-pcie a40000000.pcie: PCIe Gen.3 x4 link up
pcieport 0000:00:00.0: Root Port has been reset
pcieport 0000:00:00.0: AER: device recovery successful

Both before and after the link down, we get 19 / 23 tests passed when running the pci_endpoint selftest.

Without this patch, after the link down, all BAR tests and MSI/MSI-X tests fail.

(Side node: When testing this patch on top of Mani's v7 series, MSI/MSI-X tests still failed. Nice to see that this is no longer the case when testing on top of v8. I did not do a deep dive to figure out exactly which change between v7 and v8 that made all tests pass. It is obviously not:
[PATCH v8 1/5] PCI: dwc: ep: Clear MSI iATU mapping in dw_pcie_ep_cleanup() as pcie-dw-rockchip.c never calls this function.
Thus, it must be some of the other changes between v7 and v8, or some change in PCI core which now saves the config space during enumeration, which made MSI/MSI-X work after a link down.)

Kind regards,
Niklas

Wilfred Mallawa (1):
PCI: dw-rockchip: Add support to reset Root Port upon link down event

 drivers/pci/controller/dwc/Kconfig            |   1 +
 drivers/pci/controller/dwc/pcie-dw-rockchip.c | 134 +++++++++++++++++-
 2 files changed, 132 insertions(+), 3 deletions(-)
Signature · 1 line
2.55.0