diff options
author | Richard Cochran <rcochran@linutronix.de> | 2016-07-13 13:16:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-15 04:40:26 -0400 |
commit | 2dab90932fd08f101a45acc0495ccd77b869da5d (patch) | |
tree | 781a2dd0aec4471ef5c9bc04612dd870751ef40d | |
parent | b04041655d0cf84b77802cb0b4517e672df04f01 (diff) |
clocksource/mips-gic: 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: 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/20160713153336.380737946@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | drivers/clocksource/mips-gic-timer.c | 38 | ||||
-rw-r--r-- | include/linux/cpuhotplug.h | 1 |
2 files changed, 14 insertions, 25 deletions
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 1572c7a778ab..d91e8725917c 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c | |||
@@ -49,10 +49,9 @@ struct irqaction gic_compare_irqaction = { | |||
49 | .name = "timer", | 49 | .name = "timer", |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static void gic_clockevent_cpu_init(struct clock_event_device *cd) | 52 | static void gic_clockevent_cpu_init(unsigned int cpu, |
53 | struct clock_event_device *cd) | ||
53 | { | 54 | { |
54 | unsigned int cpu = smp_processor_id(); | ||
55 | |||
56 | cd->name = "MIPS GIC"; | 55 | cd->name = "MIPS GIC"; |
57 | cd->features = CLOCK_EVT_FEAT_ONESHOT | | 56 | cd->features = CLOCK_EVT_FEAT_ONESHOT | |
58 | CLOCK_EVT_FEAT_C3STOP; | 57 | CLOCK_EVT_FEAT_C3STOP; |
@@ -79,19 +78,10 @@ static void gic_update_frequency(void *data) | |||
79 | clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate); | 78 | clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate); |
80 | } | 79 | } |
81 | 80 | ||
82 | static int gic_cpu_notifier(struct notifier_block *nb, unsigned long action, | 81 | static int gic_starting_cpu(unsigned int cpu) |
83 | void *data) | ||
84 | { | 82 | { |
85 | switch (action & ~CPU_TASKS_FROZEN) { | 83 | gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); |
86 | case CPU_STARTING: | 84 | return 0; |
87 | gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); | ||
88 | break; | ||
89 | case CPU_DYING: | ||
90 | gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); | ||
91 | break; | ||
92 | } | ||
93 | |||
94 | return NOTIFY_OK; | ||
95 | } | 85 | } |
96 | 86 | ||
97 | static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, | 87 | static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, |
@@ -105,10 +95,11 @@ static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, | |||
105 | return NOTIFY_OK; | 95 | return NOTIFY_OK; |
106 | } | 96 | } |
107 | 97 | ||
108 | 98 | static int gic_dying_cpu(unsigned int cpu) | |
109 | static struct notifier_block gic_cpu_nb = { | 99 | { |
110 | .notifier_call = gic_cpu_notifier, | 100 | gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); |
111 | }; | 101 | return 0; |
102 | } | ||
112 | 103 | ||
113 | static struct notifier_block gic_clk_nb = { | 104 | static struct notifier_block gic_clk_nb = { |
114 | .notifier_call = gic_clk_notifier, | 105 | .notifier_call = gic_clk_notifier, |
@@ -125,12 +116,9 @@ static int gic_clockevent_init(void) | |||
125 | if (ret < 0) | 116 | if (ret < 0) |
126 | return ret; | 117 | return ret; |
127 | 118 | ||
128 | ret = register_cpu_notifier(&gic_cpu_nb); | 119 | cpuhp_setup_state(CPUHP_AP_MIPS_GIC_TIMER_STARTING, |
129 | if (ret < 0) | 120 | "AP_MIPS_GIC_TIMER_STARTING", gic_starting_cpu, |
130 | pr_warn("GIC: Unable to register CPU notifier\n"); | 121 | gic_dying_cpu); |
131 | |||
132 | gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); | ||
133 | |||
134 | return 0; | 122 | return 0; |
135 | } | 123 | } |
136 | 124 | ||
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index d74d15a028e4..456e3d93272c 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -40,6 +40,7 @@ enum cpuhp_state { | |||
40 | CPUHP_AP_DUMMY_TIMER_STARTING, | 40 | CPUHP_AP_DUMMY_TIMER_STARTING, |
41 | CPUHP_AP_METAG_TIMER_STARTING, | 41 | CPUHP_AP_METAG_TIMER_STARTING, |
42 | CPUHP_AP_QCOM_TIMER_STARTING, | 42 | CPUHP_AP_QCOM_TIMER_STARTING, |
43 | CPUHP_AP_MIPS_GIC_TIMER_STARTING, | ||
43 | CPUHP_AP_KVM_STARTING, | 44 | CPUHP_AP_KVM_STARTING, |
44 | CPUHP_AP_NOTIFY_STARTING, | 45 | CPUHP_AP_NOTIFY_STARTING, |
45 | CPUHP_AP_ONLINE, | 46 | CPUHP_AP_ONLINE, |