Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: hongxing.zhu@oss.nxp.com
Cc: imx@lists.linux.dev, linux-pci@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v1] PCI: imx6: Update MPLLB bandwidth for i.MX95 PCIe Gen3 stability
Date: Mon, 06 Jul 2026 07:16:21 +0000	[thread overview]
Message-ID: <20260706071622.1E0131F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260706070340.3603150-1-hongxing.zhu@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Sleep in atomic context (NOIRQ) during PHY initialization causes a kernel panic.
- [Medium] Non-atomic configuration of PHY register address and enable bits potentially triggering spurious hardware accesses.
- [Low] Redundant initialization and arbitrary delay (fsleep) executed on every PHY register write.
--

commit d6071da15c88ccfbb08be55ce1c9198ec88fd68c
Author: Richard Zhu <hongxing.zhu@nxp.com>

PCI: imx6: Update MPLLB bandwidth for i.MX95 PCIe Gen3 stability

Bandwidth marginality was observed during i.MX95 Gen3 PCIe tests with
the default MPLLB_BINDWIDTH value. This margin degradation worsens
across voltage and temperature (VT) variations and different test
matrices, potentially causing link stability issues.

> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 98e1db751132a..e65def1620441 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c

[ ... ]

> @@ -269,6 +278,20 @@ static int imx95_pcie_select_ref_clk_src(struct imx_pcie *imx_pcie)
>  	return 0;
>  }
>  
> +static void imx95_pcie_phy_write(struct imx_pcie *imx_pcie, int addr, u16 data)
> +{
> +	regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_SS_RW_REG_0,
> +			   IMX95_PCIE_PHY_CR_PARA_SEL,
> +			   IMX95_PCIE_PHY_CR_PARA_SEL);
> +
> +	fsleep(200);

[Severity: Low]
Does this execute redundant initialization and an arbitrary delay on every single
PHY register write?

Because imx95_pcie_init_phy() calls imx95_pcie_phy_write() twice, this
IMX95_PCIE_PHY_CR_PARA_SEL configuration and 200us delay are performed on every
register write.

Could this be a one-time initialization prior to the write sequence rather than
per-write overhead?


[Severity: High]
Does this fsleep() cause a sleep-in-atomic bug during system resume?

The imx_pcie_resume_noirq() callback runs with local interrupts disabled, and it
calls dw_pcie_resume_noirq() -> imx_pcie_host_init() -> imx95_pcie_init_phy() ->
imx95_pcie_phy_write().

For 200us, fsleep() resolves to usleep_range() which will attempt to schedule
a sleep in this atomic context.

Should this use udelay(200) instead to safely wait?

> +	regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_REG_ADDR,
> +			   IMX95_PCIE_PHY_REG_EN, IMX95_PCIE_PHY_REG_EN);
> +	regmap_update_bits(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_REG_ADDR,
> +			   IMX95_PCIE_PHY_REG_ADDR_MASK, addr);

[Severity: Medium]
Will this sequence trigger a spurious hardware access using the old address?

By setting IMX95_PCIE_PHY_REG_EN in IMX95_PCIE_PHY_REG_ADDR before updating the
target address (IMX95_PCIE_PHY_REG_ADDR_MASK), the hardware might trigger an
access immediately upon the enable bit being set, using whatever old address was
left over in the register.

Should these bits be updated atomically in a single regmap_update_bits() call?

> +	regmap_write(imx_pcie->iomuxc_gpr, IMX95_PCIE_PHY_REG_DATA, data);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706070340.3603150-1-hongxing.zhu@oss.nxp.com?part=1

  reply	other threads:[~2026-07-06  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06  7:03 [PATCH v1] PCI: imx6: Update MPLLB bandwidth for i.MX95 PCIe Gen3 stability hongxing.zhu
2026-07-06  7:16 ` sashiko-bot [this message]
2026-07-06 16:00 ` Frank Li

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=20260706071622.1E0131F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=hongxing.zhu@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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