diff options
author | Richard Cochran <rcochran@linutronix.de> | 2016-07-13 13:16:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-15 04:40:28 -0400 |
commit | 26b8768868c090151aa8c337773d429e0d5ca727 (patch) | |
tree | b6e2cfd8e427081ac46bacef6fc731f06d4422e2 | |
parent | 9eeb2264775f0b60fcff3d186bf54c90b0191650 (diff) |
arm/twd: Convert to hotplug state machine
Install the callbacks via the state machine. The callbacks won't be invoked on
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: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153336.881124821@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/arm/kernel/smp_twd.c | 31 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 12 insertions, 20 deletions
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index b6ec65e68009..02d5e5e8d44c 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -310,24 +310,17 @@ static void twd_timer_setup(void) | |||
310 | enable_percpu_irq(clk->irq, 0); | 310 | enable_percpu_irq(clk->irq, 0); |
311 | } | 311 | } |
312 | 312 | ||
313 | static int twd_timer_cpu_notify(struct notifier_block *self, | 313 | static int twd_timer_starting_cpu(unsigned int cpu) |
314 | unsigned long action, void *hcpu) | ||
315 | { | 314 | { |
316 | switch (action & ~CPU_TASKS_FROZEN) { | 315 | twd_timer_setup(); |
317 | case CPU_STARTING: | 316 | return 0; |
318 | twd_timer_setup(); | ||
319 | break; | ||
320 | case CPU_DYING: | ||
321 | twd_timer_stop(); | ||
322 | break; | ||
323 | } | ||
324 | |||
325 | return NOTIFY_OK; | ||
326 | } | 317 | } |
327 | 318 | ||
328 | static struct notifier_block twd_timer_cpu_nb = { | 319 | static int twd_timer_dying_cpu(unsigned int cpu) |
329 | .notifier_call = twd_timer_cpu_notify, | 320 | { |
330 | }; | 321 | twd_timer_stop(); |
322 | return 0; | ||
323 | } | ||
331 | 324 | ||
332 | static int __init twd_local_timer_common_register(struct device_node *np) | 325 | static int __init twd_local_timer_common_register(struct device_node *np) |
333 | { | 326 | { |
@@ -345,9 +338,9 @@ static int __init twd_local_timer_common_register(struct device_node *np) | |||
345 | goto out_free; | 338 | goto out_free; |
346 | } | 339 | } |
347 | 340 | ||
348 | err = register_cpu_notifier(&twd_timer_cpu_nb); | 341 | cpuhp_setup_state_nocalls(CPUHP_AP_ARM_TWD_STARTING, |
349 | if (err) | 342 | "AP_ARM_TWD_STARTING", |
350 | goto out_irq; | 343 | twd_timer_starting_cpu, twd_timer_dying_cpu); |
351 | 344 | ||
352 | twd_get_clock(np); | 345 | twd_get_clock(np); |
353 | if (!of_property_read_bool(np, "always-on")) | 346 | if (!of_property_read_bool(np, "always-on")) |
@@ -365,8 +358,6 @@ static int __init twd_local_timer_common_register(struct device_node *np) | |||
365 | 358 | ||
366 | return 0; | 359 | return 0; |
367 | 360 | ||
368 | out_irq: | ||
369 | free_percpu_irq(twd_ppi, twd_evt); | ||
370 | out_free: | 361 | out_free: |
371 | iounmap(twd_base); | 362 | iounmap(twd_base); |
372 | twd_base = NULL; | 363 | twd_base = NULL; |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 2057e64e4876..ad48881ba02d 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -40,6 +40,7 @@ enum cpuhp_state { | |||
40 | CPUHP_AP_ARM_L2X0_STARTING, | 40 | CPUHP_AP_ARM_L2X0_STARTING, |
41 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, | 41 | CPUHP_AP_ARM_ARCH_TIMER_STARTING, |
42 | CPUHP_AP_DUMMY_TIMER_STARTING, | 42 | CPUHP_AP_DUMMY_TIMER_STARTING, |
43 | CPUHP_AP_ARM_TWD_STARTING, | ||
43 | CPUHP_AP_METAG_TIMER_STARTING, | 44 | CPUHP_AP_METAG_TIMER_STARTING, |
44 | CPUHP_AP_QCOM_TIMER_STARTING, | 45 | CPUHP_AP_QCOM_TIMER_STARTING, |
45 | CPUHP_AP_MIPS_GIC_TIMER_STARTING, | 46 | CPUHP_AP_MIPS_GIC_TIMER_STARTING, |