Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 04/10] PCI: dw-rockchip: Add helper function for enhanced LTSSM control mode
Date: Tue, 08 Sep 2026 15:23:07 +0000	[thread overview]
Message-ID: <20260908152308.614621F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908-rockchip-pcie-system-suspend-v6-4-fbabcca9921b@collabora.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] Variable parameter passed to FIELD_PREP_WM16() causes build failures and contains a latent logic bug.

Pre-existing issues:
- [Low] Incomplete refactoring of enhanced LTSSM control mode setup.
--

commit 754de1ab627f784507a4b699acc006187c6a91fb
Author: Sebastian Reichel <sebastian.reichel@collabora.com>

PCI: dw-rockchip: Add helper function for enhanced LTSSM control mode

Remove code duplication and improve readability by introducing a new
function to setup the enhanced LTSSM mode.

> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index 7472ec78b4738..6f84b07406d49 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> @@ -696,6 +696,18 @@ static irqreturn_t rockchip_pcie_ep_sys_irq_thread(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> +static void rockchip_pcie_enable_enhanced_ltssm_control_mode(struct rockchip_pcie *rockchip,
> +							     u32 flags)
> +{
> +	u32 val;
> +
> +	/* Enable the enhanced control mode of signal app_ltssm_enable */
> +	val = FIELD_PREP_WM16(PCIE_LTSSM_ENABLE_ENHANCE, 1);
> +	if (flags)
> +		val |= FIELD_PREP_WM16(flags, 1);

[Severity: Medium]
Does passing the variable flags to FIELD_PREP_WM16() violate the macro's
requirement for a compile-time constant mask?

If rockchip_pcie_enable_enhanced_ltssm_control_mode() is outlined, will this
trigger a BUILD_BUG_ON_MSG(!__builtin_constant_p) build failure?

Also, if a future caller passes a multi-bit mask to flags (e.g. BIT(1) |
BIT(3)), would the macro evaluate to (1 << 1) & mask, setting only BIT(1)
and writing 0 to BIT(3), despite enabling both in the upper 16 bits?

> +	rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL);
> +}

[Severity: Low]
This is a pre-existing issue, but since the goal of this helper is to remove
code duplication for setting up enhanced LTSSM mode, should the exact same
duplicate sequence in rockchip_pcie_rc_reset_root_port() also be replaced
with rockchip_pcie_enable_enhanced_ltssm_control_mode(rockchip, 0)?

drivers/pci/controller/dwc/pcie-dw-rockchip.c:rockchip_pcie_rc_reset_root_port() {
    ...
    /* LTSSM enable control mode */
    val = FIELD_PREP_WM16(PCIE_LTSSM_ENABLE_ENHANCE, 1);
    rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL);
    ...
}

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-rockchip-pcie-system-suspend-v6-0-fbabcca9921b@collabora.com?part=4

  reply	other threads:[~2026-09-08 15:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 14:51 [PATCH v6 00/10] PCI: dw-rockchip: add system suspend support Sebastian Reichel
2026-09-08 14:51 ` [PATCH v6 01/10] PCI: dw-rockchip: Fix LTSSM set functions Sebastian Reichel
2026-09-08 14:58   ` sashiko-bot
2026-09-09  0:37   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 02/10] PCI: dw-rockchip: Restore vpcie3v3 regulator handle Sebastian Reichel
2026-09-08 15:05   ` sashiko-bot
2026-09-09  0:44   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 03/10] PCI: dw-rockchip: Move devm_phy_get out of phy_init Sebastian Reichel
2026-09-08 15:04   ` sashiko-bot
2026-09-09  0:54   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 04/10] PCI: dw-rockchip: Add helper function for enhanced LTSSM control mode Sebastian Reichel
2026-09-08 15:23   ` sashiko-bot [this message]
2026-09-09  0:56   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 05/10] PCI: dw-rockchip: Add helper function for controller mode Sebastian Reichel
2026-09-08 15:03   ` sashiko-bot
2026-09-09  0:58   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 06/10] PCI: dw-rockchip: Add helper function for DDL indicator Sebastian Reichel
2026-09-08 15:00   ` sashiko-bot
2026-09-09  0:58   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 07/10] PCI: dw-rockchip: Add pme_turn_off support Sebastian Reichel
2026-09-08 15:09   ` sashiko-bot
2026-09-09  1:07   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 08/10] PCI: dw-rockchip: Set broken L1SS resume flag Sebastian Reichel
2026-09-08 14:58   ` sashiko-bot
2026-09-09  1:11   ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 09/10] PCI: dw-rockchip: Add system PM support Sebastian Reichel
2026-09-08 15:12   ` sashiko-bot
2026-09-08 14:51 ` [PATCH v6 10/10] PCI: dw-rockchip: Clear debug buffer before entering L2 Sebastian Reichel
2026-09-08 15:04   ` sashiko-bot
2026-09-09  1:14   ` Shawn Lin

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=20260908152308.614621F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sebastian.reichel@collabora.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