Skip to content

Commit d7e3fd6

Browse files
zearKAGA-KOKO
authored andcommitted
irqchip/jcore-aic, clocksource/drivers/jcore: Fix jcore-pit interrupt request
The jcore-aic irqchip does not have separate interrupt numbers reserved for cpu-local vs global interrupts. Therefore the device drivers need to request the given interrupt as per CPU interrupt. 69a9dcb ("clocksource/drivers/jcore: Use request_percpu_irq()") converted the clocksource driver over to request_percpu_irq(), but failed to do add all the required changes, resulting in a failure to register PIT interrupts. Fix this by: 1) Explicitly mark the interrupt via irq_set_percpu_devid() in jcore_pit_init(). 2) Enable and disable the per CPU interrupt in the CPU hotplug callbacks. 3) Pass the correct per-cpu cookie to the irq handler by using handle_percpu_devid_irq() instead of handle_percpu_irq() in handle_jcore_irq(). [ tglx: Massage change log ] Fixes: 69a9dcb ("clocksource/drivers/jcore: Use request_percpu_irq()") Signed-off-by: Artur Rojek <contact@artur-rojek.eu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Uros Bizjak <ubizjak@gmail.com> Link: https://lore.kernel.org/all/20250216175545.35079-3-contact@artur-rojek.eu
1 parent 4cb7779 commit d7e3fd6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

drivers/clocksource/jcore-pit.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ static int jcore_pit_local_init(unsigned cpu)
114114
pit->periodic_delta = DIV_ROUND_CLOSEST(NSEC_PER_SEC, HZ * buspd);
115115

116116
clockevents_config_and_register(&pit->ced, freq, 1, ULONG_MAX);
117+
enable_percpu_irq(pit->ced.irq, IRQ_TYPE_NONE);
118+
119+
return 0;
120+
}
121+
122+
static int jcore_pit_local_teardown(unsigned cpu)
123+
{
124+
struct jcore_pit *pit = this_cpu_ptr(jcore_pit_percpu);
125+
126+
pr_info("Local J-Core PIT teardown on cpu %u\n", cpu);
127+
128+
disable_percpu_irq(pit->ced.irq);
117129

118130
return 0;
119131
}
@@ -168,6 +180,7 @@ static int __init jcore_pit_init(struct device_node *node)
168180
return -ENOMEM;
169181
}
170182

183+
irq_set_percpu_devid(pit_irq);
171184
err = request_percpu_irq(pit_irq, jcore_timer_interrupt,
172185
"jcore_pit", jcore_pit_percpu);
173186
if (err) {
@@ -237,7 +250,7 @@ static int __init jcore_pit_init(struct device_node *node)
237250

238251
cpuhp_setup_state(CPUHP_AP_JCORE_TIMER_STARTING,
239252
"clockevents/jcore:starting",
240-
jcore_pit_local_init, NULL);
253+
jcore_pit_local_init, jcore_pit_local_teardown);
241254

242255
return 0;
243256
}

drivers/irqchip/irq-jcore-aic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static struct irq_chip jcore_aic;
3838
static void handle_jcore_irq(struct irq_desc *desc)
3939
{
4040
if (irqd_is_per_cpu(irq_desc_get_irq_data(desc)))
41-
handle_percpu_irq(desc);
41+
handle_percpu_devid_irq(desc);
4242
else
4343
handle_simple_irq(desc);
4444
}

0 commit comments

Comments
 (0)