aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Cochran <rcochran@linutronix.de>2016-07-13 13:16:42 -0400
committerIngo Molnar <mingo@kernel.org>2016-07-15 04:40:25 -0400
commit31e8e5db8849e4c7084dd5bce7b7d96d2fb14b8b (patch)
tree20f691d1c89304a88b3316fe3366b425ae37801c
parent00c1d17aab513d3b8117fb84644eba39434b33e4 (diff)
clocksource/metag: 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: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: James Hogan <james.hogan@imgtec.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-metag@vger.kernel.org Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153336.215137642@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/clocksource/metag_generic.c33
-rw-r--r--include/linux/cpuhotplug.h1
2 files changed, 7 insertions, 27 deletions
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index bcd5c0d602a0..a80ab3e446b7 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -90,7 +90,7 @@ unsigned long long sched_clock(void)
90 return ticks << HARDWARE_TO_NS_SHIFT; 90 return ticks << HARDWARE_TO_NS_SHIFT;
91} 91}
92 92
93static void arch_timer_setup(unsigned int cpu) 93static int arch_timer_starting_cpu(unsigned int cpu)
94{ 94{
95 unsigned int txdivtime; 95 unsigned int txdivtime;
96 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); 96 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
@@ -132,27 +132,9 @@ static void arch_timer_setup(unsigned int cpu)
132 val = core_reg_read(TXUCT_ID, TXTIMER_REGNUM, thread0); 132 val = core_reg_read(TXUCT_ID, TXTIMER_REGNUM, thread0);
133 __core_reg_set(TXTIMER, val); 133 __core_reg_set(TXTIMER, val);
134 } 134 }
135 return 0;
135} 136}
136 137
137static int arch_timer_cpu_notify(struct notifier_block *self,
138 unsigned long action, void *hcpu)
139{
140 int cpu = (long)hcpu;
141
142 switch (action) {
143 case CPU_STARTING:
144 case CPU_STARTING_FROZEN:
145 arch_timer_setup(cpu);
146 break;
147 }
148
149 return NOTIFY_OK;
150}
151
152static struct notifier_block arch_timer_cpu_nb = {
153 .notifier_call = arch_timer_cpu_notify,
154};
155
156int __init metag_generic_timer_init(void) 138int __init metag_generic_timer_init(void)
157{ 139{
158 /* 140 /*
@@ -170,11 +152,8 @@ int __init metag_generic_timer_init(void)
170 152
171 setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq); 153 setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq);
172 154
173 /* Configure timer on boot CPU */ 155 /* Hook cpu boot to configure the CPU's timers */
174 arch_timer_setup(smp_processor_id()); 156 return cpuhp_setup_state(CPUHP_AP_METAG_TIMER_STARTING,
175 157 "AP_METAG_TIMER_STARTING",
176 /* Hook cpu boot to configure other CPU's timers */ 158 arch_timer_starting_cpu, NULL);
177 register_cpu_notifier(&arch_timer_cpu_nb);
178
179 return 0;
180} 159}
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 81035613a836..afba3b19006c 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -38,6 +38,7 @@ enum cpuhp_state {
38 CPUHP_AP_PERF_ARM_STARTING, 38 CPUHP_AP_PERF_ARM_STARTING,
39 CPUHP_AP_ARM_ARCH_TIMER_STARTING, 39 CPUHP_AP_ARM_ARCH_TIMER_STARTING,
40 CPUHP_AP_DUMMY_TIMER_STARTING, 40 CPUHP_AP_DUMMY_TIMER_STARTING,
41 CPUHP_AP_METAG_TIMER_STARTING,
41 CPUHP_AP_KVM_STARTING, 42 CPUHP_AP_KVM_STARTING,
42 CPUHP_AP_NOTIFY_STARTING, 43 CPUHP_AP_NOTIFY_STARTING,
43 CPUHP_AP_ONLINE, 44 CPUHP_AP_ONLINE,