RE: [PATCH] PCI: rzg3s-host: Re-enumerate the bus on PCIe link-state changes

From: John Madieu

Date: Tue Jun 30 2026 - 03:26:08 EST


Hi Prabhakar,

> -----Original Message-----
> From: Lad, Prabhakar <prabhakar.csengg@xxxxxxxxx>
> Sent: mardi 30 juin 2026 00:14
> To: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx>
> Subject: Re: [PATCH] PCI: rzg3s-host: Re-enumerate the bus on PCIe link-
> state changes
>
> Hi John,
>
> Thank you for the patch.
>
> On Thu, Jun 18, 2026 at 8:10 PM John Madieu
> <john.madieu.xa@xxxxxxxxxxxxxx> wrote:
> >
> > The RZ/G3E PCIe controller does not expose the standard PCIe Slot
> > Capability registers, so the generic pciehp driver cannot be used. The
> > only link-state signal the hardware provides is the DL_UpDown bit in
> > the
> > PEIS0 event status register, which is raised on every Data Link layer
> > up/down transition.
> >
> > Enable DL_UpDown in PEIE0 and hook up an interrupt handler so the
> > driver can react to link-state changes: a device that trains after
> > boot gets enumerated, and a device that disappears on link loss is
> > removed. This provides hotplug-like behaviour without the PCI hotplug
> > core, which is unavailable for the reason above.
> >
> > On a DL_UpDown event the handler acks the W1C status bit and schedules
> > a worker that inspects PCSTAT1.DL_DOWN_STS:
> >
> > - link up: re-run max link speed negotiation, wait for the link to
> > settle and pci_rescan_bus() the root bus;
> > - link down: walk the bus in reverse and
> > pci_stop_and_remove_bus_device() each child.
> >
> > Both paths take pci_lock_rescan_remove() to serialise against the PCI
> > core.
> >
> > Link events are only acted upon once the controller is fully
> > initialised. A DL_UpDown latched while the registers are not
> > configured, for example when the event IRQ is used as a system wakeup
> > source during resume, is acknowledged but does not schedule a rescan.
> > The hw_initialized flag, set at the end of controller setup and
> > cleared on suspend, gates this.
> >
> > While at it, make probe tolerant of an absent device. Previously, if
> > the link failed to come up during rzg3s_pcie_host_init(), probe tore
> > the controller back down and failed. Distinguish this case with
> > -ENODEV, leave the controller and refclk running, and let the link-up
> > path enumerate the device once it appears.
> >
> > Signed-off-by: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx>
> > ---
> > drivers/pci/controller/pcie-rzg3s-host.c | 153
> > +++++++++++++++++++++--
> > 1 file changed, 143 insertions(+), 10 deletions(-)
> >
> There are patches already inflight for this driver [0] (which should be
> the last series). This patch doesn't apply on top of it. Please rebase on
> top of this series and send a v2 mentioning the dependency.
>
> [0] https://lore.kernel.org/all/20260629220932.861445-1-
> prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx/
>

Thanks for pointing it out. I'll rebase and resend with the
dependency specified.

Regards,
John