[PATCH v2 2/4] irqchip/ath79-misc: map the performance counter interrupt on demand
From: Rosen Penev
Date: Sat Nov 14 2026 - 18:37:51 EST
The MIPS perf code now asks for the counter overflow interrupt when the
first event is created, instead of from an early_initcall. Create the
mapping in get_c0_perfcount_int() then, instead of when the controller
is initialized, so that the controller no longer has to be ready before
the early initcalls.
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/irqchip/irq-ath79-misc.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-ath79-misc.c b/drivers/irqchip/irq-ath79-misc.c
index 258b8e9a2d57..5cedea5234e0 100644
--- a/drivers/irqchip/irq-ath79-misc.c
+++ b/drivers/irqchip/irq-ath79-misc.c
@@ -23,11 +23,19 @@
#define ATH79_MISC_IRQ_COUNT 32
#define ATH79_MISC_PERF_IRQ 5
-static int ath79_perfcount_irq;
+static struct irq_domain *ath79_misc_domain;
+/* Called by the MIPS perf code when the first event is created. */
int get_c0_perfcount_int(void)
{
- return ath79_perfcount_irq;
+ unsigned int irq;
+
+ if (!ath79_misc_domain)
+ return -1;
+
+ irq = irq_create_mapping(ath79_misc_domain, ATH79_MISC_PERF_IRQ);
+
+ return irq ? irq : -1;
}
EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
@@ -121,8 +129,6 @@ static void __init ath79_misc_intc_domain_init(
{
void __iomem *base = domain->host_data;
- ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ);
-
/* Disable and clear all interrupts */
__raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
__raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS);
@@ -157,6 +163,7 @@ static int __init ath79_misc_intc_of_init(
}
ath79_misc_intc_domain_init(domain, irq);
+ ath79_misc_domain = domain;
return 0;
}
--
2.56.1