Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 (1) · Medium: 1 · Low: 0 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 phy_device_reset(phydev, 0) call in as21xxx_match_phy_device() (as21xxx.c:1203) writes the reset line and… Pre-existing issues: - [High] This problem wasn't introduced by this patch, but it is a serious one. -- net: phy: as21xxx: Release reset before reading ID in match This patch deasserts the PHY reset in as21xxx_match_phy_device() before the PHY ID is read from the hardware. Without it, a PHY that phy_remove() left in reset reports an invalid ID on rebind and never matches. Once out of reset, the PHY reports the generic ID again and the existing firmware loading path runs.
> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c > index 5eea6baa75bfc..761458c606a26 100644 > --- a/drivers/net/phy/as21xxx.c > +++ b/drivers/net/phy/as21xxx.c > @@ -1196,6 +1196,12 @@ static int as21xxx_match_phy_device(struct phy_device *phydev, > PHY_VENDOR_AEONSEMI)) > return genphy_match_phy_device(phydev, phydrv); > > + /* phy_remove() leaves the PHY in reset and only phy_probe() releases > + * it, so release it here to be able to read the ID on rebind. No-op > + * if there is no reset or it is already released. > + */ > + phy_device_reset(phydev, 0);
[Severity: High] This is a pre-existing issue and was not introduced by this patch. The comment above says "only phy_probe() releases it". Doesn't phy_init_hw() also release the reset on a PHY that is still bound to the as21xxx driver? phy_detach() always asserts the reset, but it only releases the driver when genphy is in use: drivers/net/phy/phy_device.c:phy_detach() { ... if (phydev->is_genphy_driven) { ... device_release_driver(&phydev->mdio.dev); phydev->is_genphy_driven = 0; } /* Assert the reset signal */ phy_device_reset(phydev, 1); ... } On the next phy_attach_direct(), the as21xxx driver is still bound, so neither match nor probe runs. phy_init_hw() then deasserts the reset: drivers/net/phy/phy_device.c:phy_init_hw() { ... /* Deassert the reset signal */ phy_device_reset(phydev, 0); ... } The commit message says the PHY comes out of reset with its firmware unloaded. aeon_firmware_load() is only called from as21xxx_match_phy_device(), and the driver has no .soft_reset. as21xxx_config_init() only clears priv->top_spd: drivers/net/phy/as21xxx.c:as21xxx_config_init() { ... priv->top_spd = 0; return 0; } Would the bound driver then send IPC commands (config_aneg, LEDs and so on) to a PHY with no firmware running? In that case aeon_ipc_wait_cmd() would time out, and priv->parity_status would no longer match the hardware. The IPC parity sync, PTP clock enable and DPC RA setup done in as21xxx_probe() would also be lost and never set up again. A plain ifdown/ifup looks enough to reach this on MACs that connect the PHY in ndo_open and disconnect it in ndo_stop. stmmac is one example: it calls stmmac_init_phy() at open and phylink_disconnect_phy() at release. It needs a board that describes a reset GPIO or reset controller for the PHY. The match-time deassert added here does not cover that path. [Severity: Medium] Can this new call race with other reset writers on the same PHY? as21xxx_match_phy_device() is called through __driver_attach()->driver_match_device()->phy_bus_match() before device_lock is taken. phy_attach_direct() probes genphy through phy_probe()->phy_device_reset(0), and phy_detach() asserts the reset. Both run under RTNL only, so nothing seems to serialize them against the match path. mdio_device_reset() does an unlocked check-then-act. It only stores reset_state after it has driven the line and slept: drivers/net/phy/mdio_device.c:mdio_device_reset() { ... if (mdiodev->reset_state == value) return; if (mdiodev->reset_gpio) gpiod_set_value_cansleep(mdiodev->reset_gpio, value); ... d = value ? mdiodev->reset_assert_delay : mdiodev->reset_deassert_delay; if (d) fsleep(d); mdiodev->reset_state = value; } Take an unbound PHY held in reset (reset_state == 1). Could this sequence happen? match path (modprobe) ifup / ifdown path mdio_device_reset(0) GPIO = 0 fsleep() phy_probe()->mdio_device_reset(0) GPIO = 0, reset_state = 0 phy_detach()->mdio_device_reset(1) GPIO = 1, reset_state = 1 reset_state = 0 The line would then be asserted while reset_state says it is released. Every later phy_device_reset(phydev, 0) from phy_probe(), phy_init_hw() or this match call would return early. Wouldn't that leave the PHY stuck in reset, which is the state this patch is meant to fix? Before this patch, the match path only did MDIO reads under the bus lock and never touched reset_state.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40collabora.com