Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Claudiu Beznea" <claudiu.beznea@kernel.org>
Cc: linux-pci@vger.kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 6/6] PCI: rzg3s-host: Fix NVMe resume errors after s2idle
Date: Thu, 03 Dec 2026 11:11:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-247651@kernel.org> (raw)
In-Reply-To: <20261203093224.247349-7-claudiu.beznea@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] PCI: rzg3s-host: missing select PCI_HOST_COMMON causes link
  failure
- [High] PCI: rzg3s-host: s2idle awake path triggers MSTOP via
  rzg2l_cpg_resume()
--

commit 7fbedf2fb7e05ca948fe32fe8ee79c121d940a34
Author: Ovidiu Panait <ovidiu.panait.rb@renesas.com>

PCI: rzg3s-host: Fix NVMe resume errors after s2idle

This commit skips powering down and reinitializing the PCIe host
controller across s2idle when D3cold is not possible, keeping its PM
domain clocks active via device_set_awake_path() and tracking the suspend
state in host->suspended.

> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index ad75e68952590..67a338cece3e2 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c

[ ... ]

> @@ -1936,11 +1939,19 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
>  static int rzg3s_pcie_suspend_noirq(struct device *dev)
>  {
>  	struct rzg3s_pcie_host *host = dev_get_drvdata(dev);
> +	struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
>  	const struct rzg3s_pcie_soc_data *data = host->data;
>  	struct rzg3s_pcie_port *port = &host->port;
>  	struct rzg3s_sysc *sysc = host->sysc;
> +	bool pme_capable;
>  	int ret;
>  
> +	if (pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
> +	    !pci_host_common_d3cold_possible(bridge, &pme_capable)) {
> +		device_set_awake_path(dev);
> +		return 0;
> +	}

[Severity: High]
Does this fail to link vmlinux when CONFIG_PCI_HOST_COMMON is not built in?

pci_host_common_d3cold_possible() is a non-inline function in
drivers/pci/controller/pci-host-common.c, while
CONFIG_PCIE_RENESAS_RZG3S_HOST is bool and does not select PCI_HOST_COMMON.

When CONFIG_PCI_HOST_COMMON is n or m (for example when
CONFIG_PCI_HOST_GENERIC=m is the only selector), linking fails with an
undefined reference to pci_host_common_d3cold_possible().  Adding
"select PCI_HOST_COMMON" to PCIE_RENESAS_RZG3S_HOST would fix this.

[ ... ]

> @@ -1984,6 +1997,9 @@ static int rzg3s_pcie_resume_noirq(struct device *dev)
>  	struct rzg3s_sysc *sysc = host->sysc;
>  	int ret;
>  
> +	if (!host->suspended)
> +		return 0;

[Severity: High]
Can skipping suspend on s2idle leave the PCIe controller hardware-stopped
in MSTOP after resume on RZ/G3S and RZ/G3L?

On RZ/G3S and RZ/G3L (rzg2l-cpg.c), pci_aclk shares its MSTOP bit with
pci_clkl1pm, which is in no_pm_mod_clks and remains disabled.  With
device_set_awake_path(dev) set, genpd_finish_suspend() skips
pm_clk_suspend(), leaving pci_aclk enabled and mstop->usecnt nonzero.

On s2idle resume, rzg2l_cpg_resume() calls
rzg2l_mod_enable_crit_clock_init_mstop() ->
rzg2l_mod_clock_init_mstop_helper() for every module clock.  Seeing the
disabled pci_clkl1pm, it calls rzg2l_mod_clock_module_set_state(clk, true):

drivers/clk/renesas/rzg2l-cpg.c:rzg2l_mod_clock_module_set_state() {
    ...
		/* Allow updates on probe when usecnt = 0. */
		if (!atomic_read(&mstop->usecnt))
			update = true;
		else
			update = atomic_dec_and_test(&mstop->usecnt);
    ...
}

This decrements the shared mstop->usecnt to 0 (on the first s2idle resume
on RZ/G3S, or the second on RZ/G3L) and asserts MSTOP.  Because
genpd_finish_resume() skips pm_clk_resume() and rzg3s_pcie_resume_noirq()
returns early, the controller stays stopped when NVMe resumes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203093224.247349-1-claudiu.beznea@kernel.org?part=6

      parent reply	other threads:[~2026-12-03 11:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:32 [PATCH 0/6] PCI: rzg3s-host: Fixes Claudiu Beznea
2026-12-03  9:32 ` [PATCH 1/6] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order Claudiu Beznea
2026-12-03  9:51   ` sashiko-bot
2026-12-03  9:32 ` [PATCH 2/6] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
2026-12-03 10:10   ` sashiko-bot
2026-12-03  9:32 ` [PATCH 3/6] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Claudiu Beznea
2026-12-03 10:27   ` sashiko-bot
2026-12-03  9:32 ` [PATCH 4/6] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Claudiu Beznea
2026-12-03 10:47   ` sashiko-bot
2026-12-03  9:32 ` [PATCH 5/6] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers Claudiu Beznea
2026-12-03 10:57   ` sashiko-bot
2026-12-03  9:32 ` [PATCH 6/6] PCI: rzg3s-host: Fix NVMe resume errors after s2idle Claudiu Beznea
2026-12-03  9:44   ` Wolfram Sang
2026-12-03  9:55     ` Claudiu Beznea
2026-12-03 10:32       ` Wolfram Sang
2026-12-03 11:11   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247651@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=claudiu.beznea@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox