Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marek Vasut" <marek.vasut+renesas@mailbox.org>
Cc: wsa+renesas@sang-engineering.com, linux-pci@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5] PCI: rcar-gen4: Add missing PM ops
Date: Sun, 04 Oct 2026 01:31:30 +0000	[thread overview]
Message-ID: <20261004013131.0C7D81F0089B@smtp.kernel.org> (raw)
In-Reply-To: <20261004011851.866833-1-marek.vasut+renesas@mailbox.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pcie: deadlocks due to ioremap and request_firmware in NOIRQ PM phase
--

commit e6c055f1eedf6bd5c13e231da24f0c6a76a24ba2
Author: Marek Vasut <marek.vasut+renesas@mailbox.org>

PCI: rcar-gen4: Add missing PM ops

The R-Car Gen4 PCIe controller needs to gracefully suspend and resume its
link across system suspend/resume cycles to support power domains shutting
down. This patch adds suspend_noirq and resume_noirq PM operations to tear
down the link on suspend and restart it on resume.

> diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> index 2e7a8d85c0060..fceecbd16355c 100644
> --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c

[ ... ]

> @@ -1062,6 +1064,26 @@ static int rcar_gen4_pcie_ltssm_control(struct rcar_gen4_pcie *rcar, bool enable
>  	return 0;
>  }
>  
> +static int rcar_gen4_pcie_suspend_noirq(struct device *dev)
> +{
> +	struct rcar_gen4_pcie *rcar = dev_get_drvdata(dev);
> +
> +	if (rcar->drvdata->mode != DW_PCIE_RC_TYPE)
> +		return 0;
> +
> +	return dw_pcie_suspend_noirq(&rcar->dw);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[Severity: High]
Does this code trigger a deadlock or kernel panic during the NOIRQ PM phase?

Setting pp->use_atu_msg to true causes dw_pcie_suspend_noirq() to eventually
call ioremap():

dw_pcie_suspend_noirq()
  dw_pcie_pme_turn_off()
    ioremap()

Since this runs during the suspend_noirq phase with local interrupts disabled
and the system frozen, ioremap() allocates memory with GFP_KERNEL and may
sleep, which is strictly prohibited in NOIRQ context.

> +}
> +
> +static int rcar_gen4_pcie_resume_noirq(struct device *dev)
> +{
> +	struct rcar_gen4_pcie *rcar = dev_get_drvdata(dev);
> +
> +	if (rcar->drvdata->mode != DW_PCIE_RC_TYPE)
> +		return 0;
> +
> +	return dw_pcie_resume_noirq(&rcar->dw);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[Severity: High]
Will this result in a sleeping function called from invalid context warning?

During the resume_noirq phase, this calls into the firmware request API:

dw_pcie_resume_noirq()
  dw_pcie_start_link()
    rcar_gen4_pcie_ltssm_control()
      rcar_gen4_pcie_download_phy_firmware()
        request_firmware()

Similar to the suspend path, request_firmware() allocates memory using
GFP_KERNEL and may block. Executing this with interrupts disabled in the
NOIRQ phase is unsafe and can lead to a system panic.

> +}
> +
>  static struct rcar_gen4_pcie_drvdata drvdata_r8a779f0_pcie = {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261004011851.866833-1-marek.vasut+renesas@mailbox.org?part=1

      reply	other threads:[~2026-10-04  1:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04  1:18 [PATCH v5] PCI: rcar-gen4: Add missing PM ops Marek Vasut
2026-10-04  1:31 ` 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=20261004013131.0C7D81F0089B@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=robh@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