Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marek Vasut" <marek.vasut+renesas@mailbox.org>
Cc: linux-pci@vger.kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, wsa+renesas@sang-engineering.com,
	robh@kernel.org
Subject: Re: [PATCH 3/6] PCI: rcar-gen4: Add Application/Local register reset control
Date: Thu, 03 Sep 2026 21:02:02 +0000	[thread overview]
Message-ID: <20260903210202.CC8B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903205153.283553-3-marek.vasut+renesas@mailbox.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The return value of `reset_control_deassert()` for `DW_PCIE_CORE_RST` is ignored, which can lead to a system crash (SError) if the deassertion fails.
--

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

PCI: rcar-gen4: Add Application/Local register reset control

This commit adds support for the Application/Local register reset control
for the R-Car Gen4 PCIe controller. It ensures the core reset is deasserted
after the core clock is enabled, and asserted on errors or shutdown to fix
a reinitialization failure when unbinding and rebinding the driver.

> diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> index fbe465a29068f..0c760041aacc0 100644
> --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
> @@ -197,6 +197,8 @@ static int rcar_gen4_pcie_common_init(struct rcar_gen4_pcie *rcar)
>  		return ret;
>  	}
>  
> +	reset_control_deassert(dw->core_rsts[DW_PCIE_CORE_RST].rstc);

[Severity: High]
Should the return value of reset_control_deassert() be checked here?

If the deassertion fails (e.g., returning -ENOMEM or -EIO), the PCIe core
hardware block might remain in a reset state. The code then proceeds to
access hardware registers shortly after:

rcar_gen4_pcie_common_init() {
    ...
    val = readl(rcar->base + PCIEMSR0);
    ...
}

On ARM64 platforms like R-Car, attempting MMIO reads to a peripheral that is
held in reset typically triggers a synchronous external abort (SError),
resulting in an unrecoverable kernel panic.

Since device probing can be triggered interactively via sysfs as noted in
the commit message, an unhandled reset failure could turn a normal probing
error into a system crash.

Would it be safer to check this return value and jump to err_unprepare on
failure, similar to how DW_PCIE_PWR_RST is checked later in this function?

> +
>  	if (!reset_control_status(dw->core_rsts[DW_PCIE_PWR_RST].rstc)) {
>  		reset_control_assert(dw->core_rsts[DW_PCIE_PWR_RST].rstc);
>  		/*

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

  reply	other threads:[~2026-09-03 21:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 20:50 [PATCH 1/6] dt-bindings: PCI: rcar-gen4-pci-host: Document Application/Local register reset Marek Vasut
2026-09-03 20:50 ` [PATCH 2/6] dt-bindings: PCI: rcar-gen4-pci-ep: " Marek Vasut
2026-09-03 20:57   ` sashiko-bot
2026-09-03 20:50 ` [PATCH 3/6] PCI: rcar-gen4: Add Application/Local register reset control Marek Vasut
2026-09-03 21:02   ` sashiko-bot [this message]
2026-09-03 20:50 ` [PATCH 4/6] arm64: dts: renesas: r8a779f0: Add PCIe Application/Local register reset Marek Vasut
2026-09-03 21:01   ` sashiko-bot
2026-09-03 20:50 ` [PATCH 5/6] arm64: dts: renesas: r8a779g0: " Marek Vasut
2026-09-03 21:01   ` sashiko-bot
2026-09-03 20:50 ` [PATCH 6/6] arm64: dts: renesas: r8a779h0: " Marek Vasut
2026-09-03 21:04   ` sashiko-bot
2026-09-03 20:57 ` [PATCH 1/6] dt-bindings: PCI: rcar-gen4-pci-host: Document " sashiko-bot

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=20260903210202.CC8B01F000E9@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