* [PATCH v2 net] net: ethernet: arc: emac: quiesce interrupts before requesting IRQ
@ 2026-03-09 13:24 Fan Wu
2026-03-11 2:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Fan Wu @ 2026-03-09 13:24 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, andrew+netdev, stable, Fan Wu
Normal RX/TX interrupts are enabled later, in arc_emac_open(), so probe
should not see interrupt delivery in the usual case. However, hardware may
still present stale or latched interrupt status left by firmware or the
bootloader.
If probe later unwinds after devm_request_irq() has installed the handler,
such a stale interrupt can still reach arc_emac_intr() during teardown and
race with release of the associated net_device.
Avoid that window by putting the device into a known quiescent state before
requesting the IRQ: disable all EMAC interrupt sources and clear any
pending EMAC interrupt status bits. This keeps the change hardware-focused
and minimal, while preventing spurious IRQ delivery from leftover state.
Fixes: e4f2379db6c6 ("ethernet/arc/arc_emac - Add new driver")
Cc: stable@vger.kernel.org
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
---
v2:
- address Andrew Lunn's review feedback
- use hardware-level interrupt quiescing instead of a devm conversion
- keep the fix minimal and aligned with netdev expectations
drivers/net/ethernet/arc/emac_main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 8283aeee35fb..dde4046cbf01 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -934,6 +934,17 @@ int arc_emac_probe(struct net_device *ndev, int interface)
/* Set poll rate so that it polls every 1 ms */
arc_reg_set(priv, R_POLLRATE, clock_frequency / 1000000);
+ /*
+ * Put the device into a known quiescent state before requesting
+ * the IRQ. Clear only EMAC interrupt status bits here; leave the
+ * MDIO completion bit alone and avoid writing TXPL_MASK, which is
+ * used to force TX polling rather than acknowledge interrupts.
+ */
+ arc_reg_set(priv, R_ENABLE, 0);
+ arc_reg_set(priv, R_STATUS, RXINT_MASK | TXINT_MASK | ERR_MASK |
+ TXCH_MASK | MSER_MASK | RXCR_MASK |
+ RXFR_MASK | RXFL_MASK);
+
ndev->irq = irq;
dev_info(dev, "IRQ is %d\n", ndev->irq);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 net] net: ethernet: arc: emac: quiesce interrupts before requesting IRQ
2026-03-09 13:24 [PATCH v2 net] net: ethernet: arc: emac: quiesce interrupts before requesting IRQ Fan Wu
@ 2026-03-11 2:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-11 2:20 UTC (permalink / raw)
To: Fan Wu; +Cc: netdev, davem, kuba, edumazet, pabeni, andrew+netdev, stable
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 9 Mar 2026 13:24:09 +0000 you wrote:
> Normal RX/TX interrupts are enabled later, in arc_emac_open(), so probe
> should not see interrupt delivery in the usual case. However, hardware may
> still present stale or latched interrupt status left by firmware or the
> bootloader.
>
> If probe later unwinds after devm_request_irq() has installed the handler,
> such a stale interrupt can still reach arc_emac_intr() during teardown and
> race with release of the associated net_device.
>
> [...]
Here is the summary with links:
- [v2,net] net: ethernet: arc: emac: quiesce interrupts before requesting IRQ
https://git.kernel.org/netdev/net/c/2503d08f8a2d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-11 2:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 13:24 [PATCH v2 net] net: ethernet: arc: emac: quiesce interrupts before requesting IRQ Fan Wu
2026-03-11 2:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox