From patchwork Thu Jun 16 19:06:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 888442 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5GJFJcf016514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Jun 2011 19:15:40 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXI24-0000fq-Gf; Thu, 16 Jun 2011 19:15:12 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QXI24-00058u-4R; Thu, 16 Jun 2011 19:15:12 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXI21-00058j-9p for linux-arm-kernel@canuck.infradead.org; Thu, 16 Jun 2011 19:15:09 +0000 Received: from service87.mimecast.com ([94.185.240.25]) by casper.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1QXI1y-0001cc-Vi for linux-arm-kernel@lists.infradead.org; Thu, 16 Jun 2011 19:15:07 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 16 Jun 2011 20:07:29 +0100 Received: from localhost.localdomain ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 16 Jun 2011 20:06:51 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 01/16] ARM: local timers: early device probing hooks Date: Thu, 16 Jun 2011 20:06:29 +0100 Message-Id: <1308251204-16719-2-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1308251204-16719-1-git-send-email-marc.zyngier@arm.com> References: <1308251204-16719-1-git-send-email-marc.zyngier@arm.com> X-OriginalArrivalTime: 16 Jun 2011 19:06:51.0811 (UTC) FILETIME=[8CD05730:01CC2C58] X-MC-Unique: 111061620072900401 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110616_201507_171085_238830DB X-CRM114-Status: GOOD ( 16.16 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2-r929478 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [94.185.240.25 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Thomas Gleixner , Paul Mundt , Magnus Damm , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 16 Jun 2011 19:15:40 +0000 (UTC) Introduce hooks to probe local timers registered as early devices. Use the late_time_init hook to perform the probing. Since shmobile is already using this hook, add an ARM specific arm_late_time_init hook that platforms can use instead. This is controlled by a new config option (LOCAL_TIMER_DEVICES) which prevents LOCAL_TIMERS from being selected, as the two clearly conflict. Cc: Paul Mundt Cc: Magnus Damm Signed-off-by: Marc Zyngier --- arch/arm/Kconfig | 5 ++++- arch/arm/include/asm/mach/time.h | 1 + arch/arm/kernel/time.c | 15 +++++++++++++++ arch/arm/mach-shmobile/timer.c | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index cdc89ed..dafb20a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1415,7 +1415,7 @@ config HOTPLUG_CPU config LOCAL_TIMERS bool "Use local timer interrupts" - depends on SMP + depends on SMP && !LOCAL_TIMER_DEVICES default y select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT) help @@ -1424,6 +1424,9 @@ config LOCAL_TIMERS accounting to be spread across the timer interval, preventing a "thundering herd" at every timer tick. +config LOCAL_TIMER_DEVICES + bool + source kernel/Kconfig.preempt config HZ diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h index d5adaae..f46ca39 100644 --- a/arch/arm/include/asm/mach/time.h +++ b/arch/arm/include/asm/mach/time.h @@ -43,5 +43,6 @@ struct sys_timer { }; extern void timer_tick(void); +extern void (* __initdata arm_late_time_init)(void); #endif diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index cb634c3..32d0df8 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -147,6 +148,19 @@ static int __init timer_init_syscore_ops(void) device_initcall(timer_init_syscore_ops); +void (* __initdata arm_late_time_init)(void); + +static void __init __arm_late_time_init(void) +{ + if (arm_late_time_init) + arm_late_time_init(); + +#ifdef CONFIG_LOCAL_TIMER_DEVICES + early_platform_driver_register_all("localtimer"); + early_platform_driver_probe("localtimer", 1, 0); +#endif +} + void __init time_init(void) { system_timer = machine_desc->timer; @@ -154,5 +168,6 @@ void __init time_init(void) #ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit(); #endif + late_time_init = __arm_late_time_init; } diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 895794b..835baa4 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c @@ -38,7 +38,7 @@ static void __init shmobile_late_time_init(void) static void __init shmobile_timer_init(void) { - late_time_init = shmobile_late_time_init; + arm_late_time_init = shmobile_late_time_init; } struct sys_timer shmobile_timer = {