Re: [PATCH net-next v4] net: phy: aquantia: Poll global status register for provision ID

From
netdev-bot+sashiko@kernel.org
Date
2026-11-18 17:17:23
Also in
lkml
Reply to
Hongmei Xu, 2026-11-16
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 3

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The new poll in aqr_wait_reset_complete()
  (drivers/net/phy/aquantia/aquantia_main.c, lines 720-734) treats…
- [Low] The commit message says the patch fixes a user-visible defect in
  existing AQR113 support ('Starting subsequent firmware operations…
- [Low] aqr_need_provision_id_check() (aquantia_main.c:684-690) limits
  the new wait to PHY_ID_AQR113 and PHY_ID_AQR113C.
- [Low] When the new PROV_ID poll times out, aqr_wait_reset_complete()
  logs a warning and returns 0 (aquantia_main.c:732-736).

--

net: phy: aquantia: Poll global status register for provision ID

On AQR113 and AQR113C, aqr_wait_reset_complete() now goes on to poll the
PROV_ID field of VEND1_GLOBAL_RSVD_STAT1 until it is non-zero, after the
firmware ID check. A read error is returned to the caller. A poll timeout
only logs a warning, and the function still returns 0.
Starting subsequent firmware operations before the provision ID is
valid leads to steady link failures; this has been observed during
AQR113 PHY bring-up.
[Severity: Low]
This describes a link failure with the existing AQR113 support. That
support already goes through aqr_gen4_config_init()->
aqr_gen1_config_init()->aqr_wait_reset_complete().

Should this carry a Fixes: tag and possibly Cc: stable? Is it meant for
net or net-next?
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c
index e95d391a6dc23..a5bba9be0d069 100644
--- a/drivers/net/phy/aquantia/aquantia_main.c
+++ b/drivers/net/phy/aquantia/aquantia_main.c
@@ -681,12 +681,24 @@ static int aqr107_set_tunable(struct phy_device *phydev,
 #define AQR_FW_WAIT_SLEEP_US	20000
 #define AQR_FW_WAIT_TIMEOUT_US	2000000
 
+static bool aqr_need_provision_id_check(struct phy_device *phydev)
+{
+	return phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113,
+			      phydev->drv->phy_id_mask) ||
+	       phy_id_compare(phydev->drv->phy_id, PHY_ID_AQR113C,
+			      phydev->drv->phy_id_mask);
+}
[Severity: Low]
This isn't a bug, but AQR114C, AQR115, AQR115C and AQR813 also go
through aqr_gen4_config_init() and aqr_wait_reset_complete(), and they
won't get this wait. The v4 changelog says the narrower scope is
intentional.

Were those parts checked for the same provisioning behaviour? If so,
could the commit message say so?
quoted hunk ↗ jump to hunk
+
 /* If we configure settings whilst firmware is still initializing the chip,
  * then these settings may be overwritten. Therefore make sure chip
  * initialization has completed. Use presence of the firmware ID as
  * indicator for initialization having completed.
  * The chip also provides a "reset completed" bit, but it's cleared after
  * read. Therefore function would time out if called again.
+ *
+ * On AQR113 and AQR113C, additionally wait for the provisioning ID to
+ * become non-zero, indicating that firmware provisioning is complete.
+ * Without this polling, link issue can be seen after phy boot.
  */
 int aqr_wait_reset_complete(struct phy_device *phydev)
 {
@@ -702,7 +714,26 @@ int aqr_wait_reset_complete(struct phy_device *phydev)
 		return val;
 	}
 
-	return ret;
+	if (ret)
+		return ret;
+
+	if (aqr_need_provision_id_check(phydev)) {
+		ret = read_poll_timeout(phy_read_mmd, val,
+					val < 0 ||
+					FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val),
+					AQR_FW_WAIT_SLEEP_US, AQR_FW_WAIT_TIMEOUT_US,
+					false, phydev, MDIO_MMD_VEND1,
+					VEND1_GLOBAL_RSVD_STAT1);
[Severity: Medium]
Is PROV_ID a reliable sign that provisioning is done? Elsewhere in the
driver it looks like a fixed identifier of the firmware image. It sits
next to FW_BUILD_ID and has no validity bit:

drivers/net/phy/aquantia/aquantia.h:
#define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID	GENMASK(7, 4)
#define VEND1_GLOBAL_RSVD_STAT1_PROV_ID		GENMASK(3, 0)

aqr_build_fingerprint() reads it only as one part of the image
fingerprint:

	build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val);
	prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val);

The v4 changelog also says some PHYs use PROV_ID=0 as a valid value.

aqr_need_provision_id_check() decides from the silicon ID. The PROV_ID
value, though, comes from whichever image gets loaded, whether from flash,
nvmem or the filesystem.

What happens if an AQR113/AQR113C runs an image with provisioning ID 0?

The poll could then never succeed. Every call would poll MDIO for the
full AQR_FW_WAIT_TIMEOUT_US (2 seconds) and log "Firmware provisioning ID
not ready". aqr_wait_reset_complete() is called from:

aqr107_probe()->aqr_firmware_load()->aqr_wait_reset_complete()

phy_init_hw()->aqr_gen4_config_init()->aqr_gen3_config_init()->
  aqr_gen2_config_init()->aqr_gen1_config_init()->
  aqr_wait_reset_complete()

Would bring-up then take at least 4 seconds per PHY, plus 2 seconds on
every attach and resume?

The commit message also seems to contradict itself. It says that starting
operations before the provision ID is valid "leads to steady link
failures", but also that a timeout "does not necessarily prevent link
establishment".

It also says a timeout "indicates a hardware-level provisioning failure".
Nothing in the driver appears to support that.

The driver already polls readiness signals tied to hardware state. One is
the wait_on_global_cfg poll of VEND1_GLOBAL_CFG_100M in
aqr_gen2_fill_interface_modes(). Another is
VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG. Would one of those work for AQR113
instead?
quoted hunk ↗ jump to hunk
+		if (val < 0) {
+			phydev_err(phydev, "Failed to read VEND1_GLOBAL_RSVD_STAT1: %pe\n",
+				   ERR_PTR(val));
+			return val;
+		}
+		if (ret)
+			phydev_warn(phydev, "Firmware provisioning ID not ready\n");
+	}
+
+	return 0;
 }
[Severity: Low]
This isn't a bug, but the new comment above aqr_wait_reset_complete()
says the function waits for the provisioning ID, "indicating that
firmware provisioning is complete". On timeout it only warns and
returns 0, so callers cannot tell that provisioning did not finish.

Returning 0 here looks right. aqr_firmware_load() treats -ETIMEDOUT as
"no firmware loaded" and would load a new image over the running one.
Also, aqr_gen1_config_init() does the downshift, MDI and LED writes
whatever this returns.

Could the comment say that the provisioning wait is best effort? Could it
also say that the link failure described in the commit message can still
happen after a timeout?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-aquantia-poll-global-status-register-v4-1-1b44fe85db5a%40oss.qualcomm.com
Thread (4 messages) 4 messages, 3 authors, last reply 19h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help