From: sashiko-bot@kernel.org
To: "Krishna Chaitanya Chundru" <krishna.chundru@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, vkoul@kernel.org, olteanv@gmail.com,
conor+dt@kernel.org, robh@kernel.org, neil.armstrong@linaro.org,
linux-phy@lists.infradead.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 5/5] phy: qcom: qmp-pcie: Add Nord Gen5x16 PCIe multi-PHY support
Date: Wed, 09 Sep 2026 12:07:27 +0000 [thread overview]
Message-ID: <20260909120728.3D2FC1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260909-nord-v3-5-b0a82721c547@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] The `skip_init` logic is flawed for the existing Glymur PHY platform, leading to a guaranteed NULL pointer dereference and unintended register corruption during initialization.
- [High] Accessing PHY PCS registers in `qmp_pcie_init()` before explicitly enabling the required AHB clocks leads to a synchronous external abort.
--
commit e58c7fedd872d7c03646f577c8b3832e397473b6
Author: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
phy: qcom: qmp-pcie: Add Nord Gen5x16 PCIe multi-PHY support
This commit adds support for the Nord Gen5x16 bifurcated QMP PCIe PHY.
It implements the PHY initialization sequencing including PLL, TXRXZ,
and PCS tables, handling PHY power domains against their own device.
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie-multiphy.c
[ ... ]
> +static void qmp_pcie_init_port_registers(struct qmp_pcie *qmp)
> +{
> + const struct qmp_phy_cfg *cfg = qmp->cfg;
> + const struct qmp_pcie_offsets *offs = cfg->offsets;
> + const struct qmp_phy_cfg_tbls *tbls = &cfg->tbls;
> + int i;
> +
> + for (i = 0; i < cfg->num_regs; i++) {
> + void __iomem *port = qmp->base[i];
[ ... ]
> + qmp_configure(qmp->dev, port + offs->pll,
> + tbls->pll_common, tbls->pll_common_num);
> + qmp_configure(qmp->dev, port + offs->pll,
> + cfg->pll_tbls[i], cfg->pll_nums[i]);
[Severity: Critical]
If the existing Glymur platform calls qmp_pcie_init_port_registers(), could
this dereference a null pointer? Looking at glymur_qmp_gen5x8_pciephy_cfg,
cfg->pll_tbls is not initialized and remains null.
[ ... ]
> @@ -953,6 +953,30 @@ static int qmp_pcie_init(struct phy *phy)
> {
> struct qmp_pcie *qmp = phy_get_drvdata(phy);
> const struct qmp_phy_cfg *cfg = qmp->cfg;
> + const struct qmp_pcie_offsets *offs = cfg->offsets;
> + int i, ret;
>
> ret = qmp_pcie_pd_power_on(qmp);
> if (ret)
> return ret;
>
> + /*
> + * We can skip PHY initialization if all of the following conditions
> + * are met:
> + * 1. The PHY supports the nocsr_reset that preserves the PHY config.
> + * 2. The PHY was started (and not powered down again) by the
> + * bootloader, with all of the expected bits set correctly.
> + * In this case, we can continue without having the init sequence
> + * defined in the driver.
> + */
> + qmp->skip_init = cfg->pll_tbls && qmp->nocsr_resets;
[Severity: Critical]
Because cfg->pll_tbls is null for the Glymur platform, qmp->skip_init will
always evaluate to false. Does this unintentionally force the Glymur
platform to attempt the port register initialization in qmp_pcie_power_on()?
> + for (i = 0; qmp->skip_init && i < cfg->num_regs; i++) {
> + void __iomem *port = qmp->base[i];
> +
> + if (!qphy_checkbits(port + offs->pcs, cfg->regs[QPHY_PCS_START_CONTROL],
> + SERDES_START | PCS_START) ||
> + !qphy_checkbits(port + offs->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
> + SW_PWRDN | REFCLK_DRV_DSBL))
> + qmp->skip_init = false;
> + }
[Severity: High]
Does reading QPHY_PCS_START_CONTROL here happen before the required AHB/APB
clocks are enabled? The call to clk_bulk_prepare_enable() occurs further
down in qmp_pcie_init().
If the clocks are currently disabled, such as during boot or after a suspend
cycle, will accessing these memory-mapped registers trigger a synchronous
external abort?
[ ... ]
> @@ -1067,6 +1067,20 @@ static int qmp_pcie_power_on(struct phy *phy)
> goto err_disable_pipe_clk;
> }
>
> + if (!qmp->skip_init) {
> + qmp_pcie_init_port_registers(qmp);
> +
> + for (i = 0; i < cfg->num_regs; i++) {
> + qphy_clrbits(qmp->base[i] + offs->pcs,
> + cfg->regs[QPHY_PCS_SW_RESET], SW_RESET);
[Severity: Critical]
If Glymur falls into this block due to skip_init being false, it reads
from cfg->regs[QPHY_PCS_SW_RESET]. The Glymur register layout
(pciephy_v8_50_regs_layout) does not define QPHY_PCS_SW_RESET.
Can this result in reading index 0 (which maps to QPHY_PCS_STATUS) and
writing to an undefined offset, thereby corrupting the PHY register at
offset 0x0?
> + qphy_setbits(qmp->base[i] + offs->pcs,
> + cfg->regs[QPHY_PCS_START_CONTROL],
> + SERDES_START | PCS_START);
> + }
> +
> + usleep_range(2000, 2500);
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909-nord-v3-0-b0a82721c547@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-09-09 12:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 11:48 [PATCH v3 0/5] Add PCIe support for Qualcomm Nord platform Krishna Chaitanya Chundru
2026-09-09 11:48 ` [PATCH v3 1/5] dt-bindings: phy: qcom: add Nord QMP PCIe PHY binding Krishna Chaitanya Chundru
2026-09-09 11:53 ` sashiko-bot
2026-09-10 6:43 ` Shawn Guo
2026-09-10 7:14 ` Manivannan Sadhasivam
2026-09-10 10:03 ` Krzysztof Kozlowski
2026-09-09 11:48 ` [PATCH v3 2/5] dt-bindings: pci: qcom: add Nord PCIe controller compatible Krishna Chaitanya Chundru
2026-09-09 11:53 ` sashiko-bot
2026-09-10 6:46 ` Shawn Guo
2026-09-09 11:48 ` [PATCH v3 3/5] PCI: qcom: Add CGC disable workaround for Nord PCIe Krishna Chaitanya Chundru
2026-09-09 11:54 ` sashiko-bot
2026-09-10 6:47 ` Shawn Guo
2026-09-10 7:20 ` Manivannan Sadhasivam
2026-09-10 7:29 ` Konrad Dybcio
2026-09-10 7:36 ` Manivannan Sadhasivam
2026-09-09 11:48 ` [PATCH v3 4/5] phy: qcom: qmp: Move qphy_setbits/clrbits/checkbits to common header Krishna Chaitanya Chundru
2026-09-09 11:54 ` sashiko-bot
2026-09-10 6:48 ` Shawn Guo
2026-09-10 7:24 ` Manivannan Sadhasivam
2026-09-09 11:48 ` [PATCH v3 5/5] phy: qcom: qmp-pcie: Add Nord Gen5x16 PCIe multi-PHY support Krishna Chaitanya Chundru
2026-09-09 12:07 ` sashiko-bot [this message]
2026-09-10 5:52 ` Shawn Guo
2026-09-10 7:35 ` Manivannan Sadhasivam
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=20260909120728.3D2FC1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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