From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753219AbcGSHdG (ORCPT ); Tue, 19 Jul 2016 03:33:06 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46650 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752477AbcGSHcP (ORCPT ); Tue, 19 Jul 2016 03:32:15 -0400 Date: Tue, 19 Jul 2016 00:31:39 -0700 From: tip-bot for Richard Cochran Message-ID: Cc: mingo@kernel.org, peterz@infradead.org, daniel.lezcano@linaro.org, rcochran@linutronix.de, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, anna-maria@linutronix.de, hpa@zytor.com, bigeasy@linutronix.de, tglx@linutronix.de Reply-To: hpa@zytor.com, anna-maria@linutronix.de, linux-kernel@vger.kernel.org, tglx@linutronix.de, bigeasy@linutronix.de, rcochran@linutronix.de, daniel.lezcano@linaro.org, torvalds@linux-foundation.org, peterz@infradead.org, mingo@kernel.org In-Reply-To: <20160713153338.229913786@linutronix.de> References: <20160713153338.229913786@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] clocksource/armada-370-xp: Convert to hotplug state machine Git-Commit-ID: 2c48fef74ca42d05c3efd4345b8a068ebf479a5f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2c48fef74ca42d05c3efd4345b8a068ebf479a5f Gitweb: http://git.kernel.org/tip/2c48fef74ca42d05c3efd4345b8a068ebf479a5f Author: Richard Cochran AuthorDate: Wed, 13 Jul 2016 17:17:06 +0000 Committer: Ingo Molnar CommitDate: Fri, 15 Jul 2016 10:41:45 +0200 clocksource/armada-370-xp: 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 Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Cc: Daniel Lezcano Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153338.229913786@linutronix.de Signed-off-by: Ingo Molnar --- drivers/clocksource/time-armada-370-xp.c | 41 +++++++++----------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c index 20ec066..719b478 100644 --- a/drivers/clocksource/time-armada-370-xp.c +++ b/drivers/clocksource/time-armada-370-xp.c @@ -170,10 +170,10 @@ static irqreturn_t armada_370_xp_timer_interrupt(int irq, void *dev_id) /* * Setup the local clock events for a CPU. */ -static int armada_370_xp_timer_setup(struct clock_event_device *evt) +static int armada_370_xp_timer_starting_cpu(unsigned int cpu) { + struct clock_event_device *evt = per_cpu_ptr(armada_370_xp_evt, cpu); u32 clr = 0, set = 0; - int cpu = smp_processor_id(); if (timer25Mhz) set = TIMER0_25MHZ; @@ -200,35 +200,15 @@ static int armada_370_xp_timer_setup(struct clock_event_device *evt) return 0; } -static void armada_370_xp_timer_stop(struct clock_event_device *evt) +static int armada_370_xp_timer_dying_cpu(unsigned int cpu) { + struct clock_event_device *evt = per_cpu_ptr(armada_370_xp_evt, cpu); + evt->set_state_shutdown(evt); disable_percpu_irq(evt->irq); + return 0; } -static int armada_370_xp_timer_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: - armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt)); - break; - case CPU_DYING: - armada_370_xp_timer_stop(this_cpu_ptr(armada_370_xp_evt)); - break; - } - - return NOTIFY_OK; -} - -static struct notifier_block armada_370_xp_timer_cpu_nb = { - .notifier_call = armada_370_xp_timer_cpu_notify, -}; - static u32 timer0_ctrl_reg, timer0_local_ctrl_reg; static int armada_370_xp_timer_suspend(void) @@ -322,8 +302,6 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np) return res; } - register_cpu_notifier(&armada_370_xp_timer_cpu_nb); - armada_370_xp_evt = alloc_percpu(struct clock_event_device); if (!armada_370_xp_evt) return -ENOMEM; @@ -341,9 +319,12 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np) return res; } - res = armada_370_xp_timer_setup(this_cpu_ptr(armada_370_xp_evt)); + res = cpuhp_setup_state(CPUHP_AP_ARMADA_TIMER_STARTING, + "AP_ARMADA_TIMER_STARTING", + armada_370_xp_timer_starting_cpu, + armada_370_xp_timer_dying_cpu); if (res) { - pr_err("Failed to setup timer"); + pr_err("Failed to setup hotplug state and timer"); return res; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 7ad8a7e7..ee7f750 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -53,6 +53,7 @@ enum cpuhp_state { CPUHP_AP_ARM_TWD_STARTING, CPUHP_AP_METAG_TIMER_STARTING, CPUHP_AP_QCOM_TIMER_STARTING, + CPUHP_AP_ARMADA_TIMER_STARTING, CPUHP_AP_MIPS_GIC_TIMER_STARTING, CPUHP_AP_KVM_STARTING, CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,