From 2fa599b850b688eb3a30b043c3194a4faf53afe0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 2 Oct 2024 09:38:56 +0000 Subject: [PATCH] Revert "clocksource/drivers/timer-of: Remove percpu irq related code" This reverts commit b62c4a07a3757434ddfcfac4821a82d9082c1907 which is commit 471ef0b5a8aaca4296108e756b970acfc499ede4 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I9569403775730bf2219ee35aaf361371a0e961f4 Signed-off-by: Greg Kroah-Hartman --- drivers/clocksource/timer-of.c | 17 +++++++++++++---- drivers/clocksource/timer-of.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c index b7c186dc83da..59bc5921acad 100644 --- a/drivers/clocksource/timer-of.c +++ b/drivers/clocksource/timer-of.c @@ -25,7 +25,10 @@ static void timer_of_irq_exit(struct of_timer_irq *of_irq) struct clock_event_device *clkevt = &to->clkevt; - free_irq(of_irq->irq, clkevt); + if (of_irq->percpu) + free_percpu_irq(of_irq->irq, clkevt); + else + free_irq(of_irq->irq, clkevt); } /** @@ -39,6 +42,9 @@ static void timer_of_irq_exit(struct of_timer_irq *of_irq) * - Get interrupt number by name * - Get interrupt number by index * + * When the interrupt is per CPU, 'request_percpu_irq()' is called, + * otherwise 'request_irq()' is used. + * * Returns 0 on success, < 0 otherwise */ static int timer_of_irq_init(struct device_node *np, @@ -63,9 +69,12 @@ static int timer_of_irq_init(struct device_node *np, return -EINVAL; } - ret = request_irq(of_irq->irq, of_irq->handler, - of_irq->flags ? of_irq->flags : IRQF_TIMER, - np->full_name, clkevt); + ret = of_irq->percpu ? + request_percpu_irq(of_irq->irq, of_irq->handler, + np->full_name, clkevt) : + request_irq(of_irq->irq, of_irq->handler, + of_irq->flags ? of_irq->flags : IRQF_TIMER, + np->full_name, clkevt); if (ret) { pr_err("Failed to request irq %d for %pOF\n", of_irq->irq, np); return ret; diff --git a/drivers/clocksource/timer-of.h b/drivers/clocksource/timer-of.h index 367d7023c623..5d1472846346 100644 --- a/drivers/clocksource/timer-of.h +++ b/drivers/clocksource/timer-of.h @@ -11,6 +11,7 @@ struct of_timer_irq { int irq; int index; + int percpu; const char *name; unsigned long flags; irq_handler_t handler;