From: Jakub Kicinski <kuba@kernel.org>
To: bartosz.golaszewski@oss.qualcomm.com
Cc: Jakub Kicinski <kuba@kernel.org>,
andersson@kernel.org, konradybcio@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
vkoul@kernel.org, peppe.cavallaro@st.com, wens@kernel.org,
jernej.skrabec@gmail.com, neil.armstrong@linaro.org,
khilman@baylibre.com, jbrunet@baylibre.com, shawnguo@kernel.org,
festevam@gmail.com, jan.petrous@oss.nxp.com, s32@nxp.com,
mohd.anwar@oss.qualcomm.com, romain.gantois@bootlin.com,
geert+renesas@glider.be, magnus.damm@gmail.com,
mripard@kernel.org, christophe.roullier@foss.st.com,
brgl@kernel.org, radu@rendec.net, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, dfustini@tenstorrent.com,
linux-sunxi@lists.linux.dev, linux-amlogic@lists.infradead.org,
linux-mips@vger.kernel.org, imx@lists.linux.dev,
linux-renesas-soc@vger.kernel.org,
linux-rockchip@lists.infradead.org, sophgo@lists.linux.dev,
linux-riscv@lists.infradead.org, bartosz.golaszewski@linaro.org
Subject: Re: [PATCH net-next v14 06/10] net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish()
Date: Mon, 14 Sep 2026 16:16:09 -0700 [thread overview]
Message-ID: <20260914231609.704288-1-kuba@kernel.org> (raw)
In-Reply-To: <20260908-qcom-sa8255p-emac-v14-6-ec212b747a7d@oss.qualcomm.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish()
This makes ethqos_mac_finish_serdes() store the interface that phylink
resolved into ethqos->phy_mode, so that a later serdes_powerup() call
programs the SerDes for the interface currently in use rather than the one
read from the DT phy-mode property at probe.
A few questions below.
[Severity: Low]
The commit message says:
"The next serdes_powerup() call, on a subsequent link cycle, then
reinitialises the SerDes to the wrong mode."
That describes a concrete hardware failure, but there is no Fixes: tag and
no mention of affected platforms or kernels.
Looking at the baseline, qcom_ethqos_serdes_powerup() does not read
ethqos->phy_mode at all:
static int qcom_ethqos_serdes_powerup(struct net_device *ndev, void *priv)
{
struct qcom_ethqos *ethqos = priv;
int ret;
ret = phy_init(ethqos->serdes_phy);
if (ret)
return ret;
ret = phy_power_on(ethqos->serdes_phy);
...
The phy_set_mode_ext(..., ethqos->phy_mode) call that consumes the stale
value is added by the preceding patch in this series, "net: stmmac:
qcom-ethqos: set serdes mode before powerup" (7bf7d5daca55). So the
condition being repaired here does not exist upstream, and a Fixes: tag
would have to point at an unmerged in-series commit.
Would it make more sense to fold this hunk into that patch, or reorder the
two, and reword the message so it does not read as a fix for a shipping
regression? As posted it is hard for a backporter to tell whether this is a
stable candidate or preparation work.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index 47b70b5e706f2..fd7414a50eb4e 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -634,6 +634,12 @@ static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv,
>
> qcom_ethqos_set_sgmii_loopback(ethqos, false);
>
> + /* The interface mode is only known once phylink has resolved it and
> + * may change at runtime, so keep it in sync for later
> + * serdes_powerup()/serdes_powerdown() calls.
> + */
[Severity: Low]
This isn't a bug, but does qcom_ethqos_serdes_powerdown() really depend on
this field?
static void qcom_ethqos_serdes_powerdown(struct net_device *ndev, void *priv)
{
struct qcom_ethqos *ethqos = priv;
phy_power_off(ethqos->serdes_phy);
phy_exit(ethqos->serdes_phy);
}
It takes no interface argument and never reads ethqos->phy_mode. The two
readers of the field are qcom_ethqos_serdes_powerup() and
qcom_ethqos_set_sgmii_loopback(); the latter is the one whose behaviour
this assignment changes, and it is not mentioned in the comment.
> + ethqos->phy_mode = interface;
[Severity: High]
Can this break qcom_ethqos_set_sgmii_loopback() on sa8775p?
That helper gates on phy_mode being exactly the DT interface:
static void
qcom_ethqos_set_sgmii_loopback(struct qcom_ethqos *ethqos, bool enable)
{
if (!ethqos->needs_sgmii_loopback ||
ethqos->phy_mode != PHY_INTERFACE_MODE_2500BASEX)
return;
...
and it is called from ethqos_clks_config() with the clocks just enabled:
ethqos_clks_config()
/* Enable functional clock to prevent DMA reset to timeout due
* to lacking PHY clock after the hardware block has been power
* cycled. ...
*/
qcom_ethqos_set_sgmii_loopback(ethqos, true);
ethqos_set_func_clk_en(ethqos);
ethqos_clks_config() runs at probe and again on every resume through
stmmac_bus_clks_config() -> plat_dat->clks_config(), i.e. before phylink
has resolved anything for the new session, so it reads whatever the
previous session left behind.
emac_v4_0_0_data sets .needs_sgmii_loopback = true, so on a 2500base-x
board that last linked at 1G SGMII:
ethqos_mac_finish_serdes() -> ethqos->phy_mode = PHY_INTERFACE_MODE_SGMII
suspend / ifdown
resume -> ethqos_clks_config(true)
-> qcom_ethqos_set_sgmii_loopback(ethqos, true) /* returns early */
-> DMA soft reset with no RX clock
Does dwmac4_dma_reset() then time out and fail open()/resume?
The next patch in this series, "net: stmmac: qcom-ethqos: fix SGMII
loopback not set on resume after speed change", describes the same symptom
("any subsequent resume with a 1G SGMII link skips the loopback setup and
the DMA reset hangs") and widens the guard to also accept SGMII. Could the
guard change be squashed into this patch, or this patch ordered after it,
so that a bisect landing here does not hang resume?
Separately, even with the widened guard the workaround is keyed on
{2500BASEX, SGMII} only, while phylink hands mac_finish() whatever the PHY
reported:
drivers/net/phy/phylink.c:phylink_resolve()
...
link_state.interface = pl->phy_state.interface;
Would keeping the DT interface in its own field for the wrapper workaround,
and using the resolved interface only for the SerDes mode, avoid coupling
the two?
> if (interface == PHY_INTERFACE_MODE_SGMII ||
> interface == PHY_INTERFACE_MODE_2500BASEX)
> ret = phy_set_mode_ext(ethqos->serdes_phy, PHY_MODE_ETHERNET,
[ ... ]
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-09-14 23:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:57 [PATCH net-next v14 00/10] net: stmmac: qcom-ethqos: add support for SCMI power domains Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 01/10] net: phy: aquantia: fix system interface type not updated in forced mode Bartosz Golaszewski
2026-09-14 23:14 ` Jakub Kicinski
2026-09-08 14:57 ` [PATCH net-next v14 02/10] dt-bindings: phy: document the serdes PHY on sa8255p Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 03/10] phy: qcom: add the SGMII SerDes PHY driver for SCMI systems Bartosz Golaszewski
2026-09-09 17:09 ` sashiko-bot
2026-09-14 23:16 ` Jakub Kicinski
2026-09-08 14:57 ` [PATCH net-next v14 04/10] dt-bindings: net: qcom: document the ethqos device for SCMI-based systems Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 05/10] net: stmmac: qcom-ethqos: set serdes mode before powerup Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 06/10] net: stmmac: qcom-ethqos: update phy_mode to the resolved interface in mac_finish() Bartosz Golaszewski
2026-09-14 23:16 ` Jakub Kicinski [this message]
2026-09-08 14:57 ` [PATCH net-next v14 07/10] net: stmmac: qcom-ethqos: fix SGMII loopback not set on resume after speed change Bartosz Golaszewski
2026-09-14 23:16 ` Jakub Kicinski
2026-09-08 14:57 ` [PATCH net-next v14 08/10] net: stmmac: qcom-ethqos: reuse the address of ethqos_emac_driver_data Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 09/10] net: stmmac: qcom-ethqos: factor out linux-level setup into a separate function Bartosz Golaszewski
2026-09-08 14:57 ` [PATCH net-next v14 10/10] net: stmmac: qcom-ethqos: add support for sa8255p Bartosz Golaszewski
2026-09-14 23:15 ` [PATCH net-next v14 00/10] net: stmmac: qcom-ethqos: add support for SCMI power domains Jakub Kicinski
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=20260914231609.704288-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bartosz.golaszewski@linaro.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=christophe.roullier@foss.st.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dfustini@tenstorrent.com \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=imx@lists.linux.dev \
--cc=jan.petrous@oss.nxp.com \
--cc=jbrunet@baylibre.com \
--cc=jernej.skrabec@gmail.com \
--cc=khilman@baylibre.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=magnus.damm@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mohd.anwar@oss.qualcomm.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=radu@rendec.net \
--cc=robh@kernel.org \
--cc=romain.gantois@bootlin.com \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
--cc=sophgo@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=wens@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
all inboxes | Powered by JetHome®