Re: [PATCH net] net: phy: postpone PHY interrupts during sleep with MAC-managed PM

From: Igor Velkov

Date: Sun Oct 04 2026 - 14:23:44 EST


On Sun, Oct 04, 2026 at 04:28:50PM +0200, Andrew Lunn wrote:
> One obvious question. What exactly does it mean when the MAC driver
> manages PHY PM. Maybe calling irq_suspend is part of that management?

The commit that added the flag, fba863b81604 ("net: phy: make PHY PM
ops a no-op if MAC driver manages PHY PM"), says the MAC drivers "take
care of suspending/resuming the PHY", so that "the MAC PM callbacks can
handle any dependency between MAC and PHY PM". The bug it fixed was
phy_init_hw() from mdio_bus_phy_resume() running after the MAC's
phy_start().

irq_suspended came later, in 1758bde2e4aa ("net: phy: Don't trigger
state machine while in suspend"), for a different window, and was
placed after the existing mac_managed_pm return; its commit message
does not mention mac_managed_pm. So nothing sets irq_suspended for
these PHYs: phylib returns early and no MAC driver touches the flag.

> What exactly is going wrong with the ordering in your case?

The callback order is fine; the interrupt does not wait for it.
resume_device_irqs() runs at the end of dpm_resume_noirq(), before the
early and normal phases. The wake interrupt is pending by then, so
phy_interrupt() runs at once, while stmmac_resume(), which powers the
GMAC up through rk_gmac_resume(), runs only in the normal phase.
1758bde2e4aa describes the same window: "between dpm_resume_noirq()
and mdio_bus_phy_resume()".

As for the MDIO bus: with stmmac it is the MAC's own registers;
mdio_bus_class has no PM callbacks, so the bus goes down with the MAC
in rk_gmac_suspend().

If the MAC should cover this window instead, irq_suspended could be
set and cleared in phylink_suspend()/phylink_resume(), but only
stmmac, lan78xx and asix call them; macb, axienet, am65-cpsw, ngbe and
the phylib-only drivers (fec, ravb, bcmgenet, cpsw, ...) would stay
uncovered. Which would you prefer?

Either way, v2 will reword the comment you quoted: the point is not the
MDIO bus but that the interrupt can fire before the MAC resumes the PHY.

--
Igor Velkov