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 2/6] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase
Date: Thu, 03 Dec 2026 10:10:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-247527@kernel.org> (raw)
In-Reply-To: <20261203093224.247349-3-claudiu.beznea@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] PCI: rzg3s-host: second suspend after failed resume
  underflows clk/resets
- [Low] PCI: rzg3s-host: inverted genpd stop/start order in changelog
  and comment
--

commit d950b9cde70f06d5719f83c5c0372210d7beeeeb
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase

This commit removes the pm_runtime_put_sync() and
pm_runtime_resume_and_get() calls from rzg3s_pcie_suspend_noirq() and
rzg3s_pcie_resume_noirq(), relying on the generic power domain noirq
callbacks to power the device off and on.

> the generic power domain .suspend_noirq()/.resume_noirq() callbacks
> (genpd_suspend_noirq()/genpd_resume_noirq()) invoke the driver's
> .suspend_noirq()/.resume_noirq() callbacks and call
> genpd_stop_dev()/genpd_start_dev() before and after them, respectively.

[Severity: Low]
Is the genpd_stop_dev()/genpd_start_dev() order inverted here?

In drivers/pmdomain/core.c, genpd_finish_suspend() calls suspend_noirq()
first and genpd_stop_dev() after it, while genpd_finish_resume() calls
genpd_start_dev() before pm_generic_resume_noirq().

The new comment in rzg3s_pcie_resume_noirq() has the same issue: it says
genpd_resume_noirq() "will enable clocks" mid-function, even though
genpd_start_dev() has already enabled them before
rzg3s_pcie_resume_noirq() is entered.

> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index 1dbe2a2a4bf1c..66a5adf9db7ec 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -1957,19 +1957,18 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
>  	if (ret)
>  		goto config_reinit;
>  
> -	ret = pm_runtime_put_sync(dev);
> -	if (ret)
> -		goto power_resets_restore;
> +	/*
> +	 * Since the power domain's genpd_suspend_noirq() will disable clocks,
> +	 * there is no need to manually invoke runtime PM API here.
> +	 */
>  
>  	ret = rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
>  	if (ret)
> -		goto rpm_resume;
> +		goto power_resets_restore;

[Severity: Medium]
Can a second system suspend after a failed rzg3s_pcie_resume_noirq() now
underflow port->refclk and double-assert host->power_resets?

When rzg3s_pcie_resume_noirq() fails (for example on a link-up timeout in
rzg3s_pcie_host_init()), it re-asserts host->power_resets and leaves
port->refclk disabled, while device_resume_noirq() still clears
is_noirq_suspended and completes system resume.

On the next suspend, rzg3s_pcie_suspend_noirq() runs again on the
already-deinitialized controller.  It disables port->refclk again, writes
host->axi + RZG3S_PCI_RESET in rzg3e_pcie_config_deinit() under reset, and
calls reset_control_bulk_assert() a second time on shared power_resets.

On single-controller SoCs this hits WARN_ON() in __reset_control_assert()
and aborts suspend with -EINVAL; on dual-controller RZ/V2H where pcie0 and
pcie1 share aresetn, it drops the sibling's count to zero and resets it.

Tracking whether the controller is already suspended and returning early in
rzg3s_pcie_suspend_noirq() would avoid tearing it down twice.

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

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

Thread overview: 13+ 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 [this message]
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  9:32 ` [PATCH 5/6] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers Claudiu Beznea
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

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-247527@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