mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-27 01:11:31 +00:00
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>
This commit is contained in:
parent
2c48fef74c
commit
eb0a9d8c67
2 changed files with 10 additions and 32 deletions
|
|
@ -172,9 +172,9 @@ static struct irqaction sirfsoc_timer1_irq = {
|
||||||
.handler = sirfsoc_timer_interrupt,
|
.handler = sirfsoc_timer_interrupt,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sirfsoc_local_timer_setup(struct clock_event_device *ce)
|
static int sirfsoc_local_timer_starting_cpu(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int cpu = smp_processor_id();
|
struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu);
|
||||||
struct irqaction *action;
|
struct irqaction *action;
|
||||||
|
|
||||||
if (cpu == 0)
|
if (cpu == 0)
|
||||||
|
|
@ -203,50 +203,27 @@ static int sirfsoc_local_timer_setup(struct clock_event_device *ce)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sirfsoc_local_timer_stop(struct clock_event_device *ce)
|
static int sirfsoc_local_timer_dying_cpu(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int cpu = smp_processor_id();
|
|
||||||
|
|
||||||
sirfsoc_timer_count_disable(1);
|
sirfsoc_timer_count_disable(1);
|
||||||
|
|
||||||
if (cpu == 0)
|
if (cpu == 0)
|
||||||
remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq);
|
remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq);
|
||||||
else
|
else
|
||||||
remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq);
|
remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sirfsoc_cpu_notify(struct notifier_block *self,
|
|
||||||
unsigned long action, void *hcpu)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Grab cpu pointer in each case to avoid spurious
|
|
||||||
* preemptible warnings
|
|
||||||
*/
|
|
||||||
switch (action & ~CPU_TASKS_FROZEN) {
|
|
||||||
case CPU_STARTING:
|
|
||||||
sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent));
|
|
||||||
break;
|
|
||||||
case CPU_DYING:
|
|
||||||
sirfsoc_local_timer_stop(this_cpu_ptr(sirfsoc_clockevent));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NOTIFY_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct notifier_block sirfsoc_cpu_nb = {
|
|
||||||
.notifier_call = sirfsoc_cpu_notify,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init sirfsoc_clockevent_init(void)
|
static int __init sirfsoc_clockevent_init(void)
|
||||||
{
|
{
|
||||||
sirfsoc_clockevent = alloc_percpu(struct clock_event_device);
|
sirfsoc_clockevent = alloc_percpu(struct clock_event_device);
|
||||||
BUG_ON(!sirfsoc_clockevent);
|
BUG_ON(!sirfsoc_clockevent);
|
||||||
|
|
||||||
BUG_ON(register_cpu_notifier(&sirfsoc_cpu_nb));
|
/* Install and invoke hotplug callbacks */
|
||||||
|
return cpuhp_setup_state(CPUHP_AP_MARCO_TIMER_STARTING,
|
||||||
/* Immediately configure the timer on the boot CPU */
|
"AP_MARCO_TIMER_STARTING",
|
||||||
return sirfsoc_local_timer_setup(this_cpu_ptr(sirfsoc_clockevent));
|
sirfsoc_local_timer_starting_cpu,
|
||||||
|
sirfsoc_local_timer_dying_cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize the kernel jiffy timer source */
|
/* initialize the kernel jiffy timer source */
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ enum cpuhp_state {
|
||||||
CPUHP_AP_METAG_TIMER_STARTING,
|
CPUHP_AP_METAG_TIMER_STARTING,
|
||||||
CPUHP_AP_QCOM_TIMER_STARTING,
|
CPUHP_AP_QCOM_TIMER_STARTING,
|
||||||
CPUHP_AP_ARMADA_TIMER_STARTING,
|
CPUHP_AP_ARMADA_TIMER_STARTING,
|
||||||
|
CPUHP_AP_MARCO_TIMER_STARTING,
|
||||||
CPUHP_AP_MIPS_GIC_TIMER_STARTING,
|
CPUHP_AP_MIPS_GIC_TIMER_STARTING,
|
||||||
CPUHP_AP_KVM_STARTING,
|
CPUHP_AP_KVM_STARTING,
|
||||||
CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
|
CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue