diff options
author | Richard Cochran <rcochran@linutronix.de> | 2016-07-13 13:17:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-15 04:41:45 -0400 |
commit | eb0a9d8c672dc01db41352afa646405d035ee7a4 (patch) | |
tree | a30810cffa2779d02c7a289f1d6b49d3694ee47b /drivers/clocksource/timer-atlas7.c | |
parent | 2c48fef74ca42d05c3efd4345b8a068ebf479a5f (diff) |
clocksource/atlas7: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Barry Song <baohua@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153338.310333816@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/clocksource/timer-atlas7.c')
-rw-r--r-- | drivers/clocksource/timer-atlas7.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/drivers/clocksource/timer-atlas7.c b/drivers/clocksource/timer-atlas7.c index 90f8fbc154a4..4334e0330ada 100644 --- a/drivers/clocksource/timer-atlas7.c +++ b/drivers/clocksource/timer-atlas7.c | |||
@@ -172,9 +172,9 @@ static struct irqaction sirfsoc_timer1_irq = { | |||
172 | .handler = sirfsoc_timer_interrupt, | 172 | .handler = sirfsoc_timer_interrupt, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | static int sirfsoc_local_timer_setup(struct clock_event_device *ce) | 175 | static int sirfsoc_local_timer_starting_cpu(unsigned int cpu) |
176 | { | 176 | { |
177 | int cpu = smp_processor_id(); | 177 | struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu); |
178 | struct irqaction *action; | 178 | struct irqaction *action; |
179 | 179 | ||
180 | if (cpu == 0) | 180 | if (cpu == 0) |
@@ -203,50 +203,27 @@ static int sirfsoc_local_timer_setup(struct clock_event_device *ce) | |||
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | 205 | ||
206 | static void sirfsoc_local_timer_stop(struct clock_event_device *ce) | 206 | static int sirfsoc_local_timer_dying_cpu(unsigned int cpu) |
207 | { | 207 | { |
208 | int cpu = smp_processor_id(); | ||
209 | |||
210 | sirfsoc_timer_count_disable(1); | 208 | sirfsoc_timer_count_disable(1); |
211 | 209 | ||
212 | if (cpu == 0) | 210 | if (cpu == 0) |
213 | remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq); | 211 | remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq); |
214 | else | 212 | else |
215 | remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq); | 213 | remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq); |
214 | return 0; | ||
216 | } | 215 | } |
217 | 216 | ||
218 | static int sirfsoc_cpu_notify(struct notifier_block *self, | ||
219 | unsigned long action, void *hcpu) | ||
220 | { | ||
221 | /* | ||
222 | * Grab cpu pointer in each case to avoid spurious | ||
223 | * preemptible warnings | ||
224 | */ | ||
225 | switch (action & ~CPU_TASKS_FROZEN) { | ||
226 | case CPU_STARTING: | ||
227 | sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent)); | ||
228 | break; | ||
229 | case CPU_DYING: | ||
230 | sirfsoc_local_timer_stop(this_cpu_ptr(sirfsoc_clockevent)); | ||
231 | break; | ||
232 | } | ||
233 | |||
234 | return NOTIFY_OK; | ||
235 | } | ||
236 | |||
237 | static struct notifier_block sirfsoc_cpu_nb = { | ||
238 | .notifier_call = sirfsoc_cpu_notify, | ||
239 | }; | ||
240 | |||
241 | static int __init sirfsoc_clockevent_init(void) | 217 | static int __init sirfsoc_clockevent_init(void) |
242 | { | 218 | { |
243 | sirfsoc_clockevent = alloc_percpu(struct clock_event_device); | 219 | sirfsoc_clockevent = alloc_percpu(struct clock_event_device); |
244 | BUG_ON(!sirfsoc_clockevent); | 220 | BUG_ON(!sirfsoc_clockevent); |
245 | 221 | ||
246 | BUG_ON(register_cpu_notifier(&sirfsoc_cpu_nb)); | 222 | /* Install and invoke hotplug callbacks */ |
247 | 223 | return cpuhp_setup_state(CPUHP_AP_MARCO_TIMER_STARTING, | |
248 | /* Immediately configure the timer on the boot CPU */ | 224 | "AP_MARCO_TIMER_STARTING", |
249 | return sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent)); | 225 | sirfsoc_local_timer_starting_cpu, |
226 | sirfsoc_local_timer_dying_cpu); | ||
250 | } | 227 | } |
251 | 228 | ||
252 | /* initialize the kernel jiffy timer source */ | 229 | /* initialize the kernel jiffy timer source */ |