[PATCH v2 0/4] irqchip/ath79-misc: probe as a platform driver
From: Rosen Penev
Date: Sat Nov 14 2026 - 18:37:43 EST
The MISC interrupt controller of the Atheros/Qualcomm ath79 SoCs is
cascaded from a CPU interrupt, and all of its users are platform
devices. It is still initialized from IRQCHIP_DECLARE, before the early
initcalls, only because the MIPS perf code asks for the performance
counter overflow interrupt, which goes through it, from an
early_initcall.
Patch 1 makes the MIPS perf code look up that interrupt when the first
event is created, which is when it is requested. Patch 2 makes the ath79
MISC driver create the mapping at that point. Patch 3 then converts the
driver to IRQCHIP_PLATFORM_DRIVER with device-managed resources, which
also fixes the leak of the register mapping on its error path. Patch 4
adds COMPILE_TEST coverage, which a platform driver makes possible.
Patch 3 depends on patch 1: without it, perf would ask for the interrupt
before the controller has probed and would lose its overflow interrupt.
Patch 1 touches only arch/mips, so the series could go through the MIPS
tree with an ack for the irqchip patches, or through irqchip with an ack
for patch 1.
The other users of get_c0_perfcount_int() (generic/GIC, Malta, Lantiq,
Ralink) return an interrupt that is set up at boot, so calling it later
does not change anything for them. The perf boot message no longer
prints the interrupt, which is not known at that point.
Tested on a TP-Link Archer C7 v2 (QCA9558), with the device tree from
the pending series that adds it: the MISC controller probes as a
platform device, its users (UART, GPIO, watchdog) probe with nothing
left deferred, and perf record gets its samples from the overflow
interrupt on MISC 5. Each patch builds with W=1 (mips, clang), and
with patch 4 the driver also builds with W=1 for arm64, x86_64 and a
non-ath79 MIPS kernel (Lantiq). The v2 change has only been build
tested: no QCA956x or TP9343 board was available.
Changes in v2:
- Patch 3: keep the MIPS timer interrupt enabled in the MISC controller
when probing. plat_time_init() enables it on QCA956x and TP9343, and
the driver now probes after it, so clearing every enable bit left
those SoCs without jiffies. Reported by the review of v1.
- Rebased on next-20261112.
v1: https://lore.kernel.org/all/20261112224445.213324-1-rosenp@xxxxxxxxx/
An AI coding assistant (Claude Code, Claude Opus 5.5) was used to write
the patches, test them on the router over its serial console, and draft
the commit messages and this cover letter.
Rosen Penev (4):
MIPS: perf: look up the PMU interrupt when it is requested
irqchip/ath79-misc: map the performance counter interrupt on demand
irqchip/ath79-misc: convert to a platform driver
irqchip/ath79-misc: allow COMPILE_TEST builds
arch/mips/kernel/perf_event_mipsxx.c | 30 ++++---
drivers/irqchip/Kconfig | 14 ++++
drivers/irqchip/Makefile | 2 +-
drivers/irqchip/irq-ath79-misc.c | 120 +++++++++++++++------------
4 files changed, 98 insertions(+), 68 deletions(-)
base-commit: 6d582d78fad9d828e575ca0cdcff8ea47a77220b
--
2.56.1