Re: [PATCH v2 09/15] PCI: rcar-gen4: Add Root Port reset support
From: Marek Vasut
Date: Sat Oct 03 2026 - 20:12:02 EST
On 9/28/26 6:52 PM, Koichiro Den wrote:
Implement the host bridge reset_root_port() callback so PCI error
recovery can reset and reinitialize the R-Car controller. This also
provides the reset operation for the link-down handling added later.
Call .reinit() with clocks and PHY initialization retained, restore
the Root Port registers and restart link training.
Rather than tracking which APP interrupt enables survive the power
reset, derive them from software state through a single helper. A flag
keeps the sources masked from the start of a reset until one succeeds,
so a failed reinitialization does not re-enable them against an
uninitialized controller.
Serialize the reset with a mutex, as not all callers hold the Root
Port's device lock: pci_try_reset_function() on a downstream device only
locks that device before falling back to a parent bus reset.
Please pardon my ignorance, but is this maybe something that could be fixed in the core code ?
[...]
+/*
+ * R-Car Gen4 controllers have a single Root Port per instance, so the
I have two nitpicks here.
First, this is also applicable to R-Car Gen5 SoC PCIe4 controller, so please rephrase as:
-R-Car Gen4 controllers ...
+R-Car Gen4 SoC PCIe controllers and R-Car Gen5 SoC PCIe4 controller ...
Second, in another review thread, Bjorn mentioned it would be good to be more explicit about what is SoC generation and what is PCIe generation:
https://lore.kernel.org/all/20260928222442.GA2266778@bhelgaas/
That is also why I used such a lengthy sentence above, that is
Controllers are here
|
_________________^__________________
| |
vvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvv
R-Car Gen4 SoC PCIe controllers and R-Car Gen5 SoC PCIe4 controller ...
^^^^^^^^ ^^^^^^^^
| |
'----------------- -----------------'
V
|
SoC generation is here
+ * 'pci_dev' is ignored and the whole controller is reset.The rest looks good, thank you !
+ */
+static int rcar_gen4_pcie_reset_root_port(struct pci_host_bridge *bridge,
+ struct pci_dev *pdev)
+{
+ struct rcar_gen4_pcie *rcar = dev_get_drvdata(bridge->dev.parent);
+ struct dw_pcie *dw = &rcar->dw;
+ struct dw_pcie_rp *pp = &dw->pp;
+ struct device *dev = dw->dev;
+ int ret;