Re: [RFC][PATCH] PCI: rcar-gen4: Add missing PM ops
From: Geert Uytterhoeven
Date: Mon Sep 07 2026 - 06:30:13 EST
Hi Marek,
On Sun, 6 Sept 2026 at 19:32, Marek Vasut
<marek.vasut+renesas@xxxxxxxxxxx> wrote:
> The R-Car Gen4 PCIe controller is part of a power domain. On R-Car S4
> and V4H, this is an always-on power domain which is not shut down in
> suspend. On R-Car V4M, this is a dedicated A2PCIPHY power domain,
> which is shut down during suspend, and the controller loses state,
> which prevents the PCIe from working after resume.
>
> Fix this by adding generic suspend/resume noirq ops for the controller,
> which tear the link down on suspend, and restart it on resume. Use the
> same PM ops on all of R-Car Gen4 to gracefully suspend and resume the
> PCIe link on V4H and S4 too.
>
> Test case which demonstrates the problem on R-Car V4M:
> "
> $ hexdump -vC /sys/bus/pci/devices/0000:00:00.0/config > /tmp/pre
> $ echo s2idle > /sys/power/mem_sleep
> $ echo platform > /sys/power/pm_test
> $ echo mem > /sys/power/state
> $ hexdump -vC /sys/bus/pci/devices/0000:00:00.0/config > /tmp/post
> $ diff -Naru /tmp/pre /tmp/post
> ...
> -00000000 12 19 32 00 07 05 10 00 00 00 04 06 00 00 01 00
> +00000000 12 19 32 00 07 05 10 00 00 00 00 ff 00 00 80 00
> ^^^^^
> Class 0604->00ff
> "
>
> Fixes: 0d0c551011df ("PCI: rcar-gen4: Add R-Car Gen4 PCIe controller support for host mode")
> Reported-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxxxx>
Thanks, the output of "lspci -v" is now the same before and after
s2idle.
Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
I don't have a setup for endpoint mode, so I could not verify or refute
Sashiko's claim that suspend will crash in endpoint mode.
> --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> @@ -952,10 +968,14 @@ static const struct of_device_id rcar_gen4_pcie_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, rcar_gen4_pcie_of_match);
>
> +DEFINE_NOIRQ_DEV_PM_OPS(rcar_gen4_pcie_pm_ops,
> + rcar_gen4_pcie_suspend_noirq, rcar_gen4_pcie_resume_noirq);
> +
> static struct platform_driver rcar_gen4_pcie_driver = {
> .driver = {
> .name = "pcie-rcar-gen4",
> .of_match_table = rcar_gen4_pcie_of_match,
> + .pm = &rcar_gen4_pcie_pm_ops,
pm_sleep_ptr(&rcar_gen4_pcie_pm_ops)
> .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> },
> .probe = rcar_gen4_pcie_probe,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds