From patchwork Mon Jun 12 16:48:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 774730 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wmf3s3fXjz9s3s for ; Tue, 13 Jun 2017 02:48:41 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754437AbdFLQsk (ORCPT ); Mon, 12 Jun 2017 12:48:40 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:41445 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754321AbdFLQsg (ORCPT ); Mon, 12 Jun 2017 12:48:36 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v5CGmY1m018130 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2017 16:48:34 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v5CGmXGu017230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jun 2017 16:48:34 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v5CGmXma005159; Mon, 12 Jun 2017 16:48:33 GMT Received: from ca-ldom103.us.oracle.com (/10.129.68.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Jun 2017 09:48:33 -0700 From: Pavel Tatashin To: sparclinux@vger.kernel.org, davem@davemloft.net Subject: [v2 6/8] sparc64: initialize time early Date: Mon, 12 Jun 2017 12:48:25 -0400 Message-Id: <1497286107-974183-7-git-send-email-pasha.tatashin@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1497286107-974183-1-git-send-email-pasha.tatashin@oracle.com> References: <1497286107-974183-1-git-send-email-pasha.tatashin@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org In Linux it is possible to configure printk() to output timestamp next to every line. This is very useful to determine the slow parts of the boot process, and also to avoid regressions, as boot time is visiable to everyone. Also, there are scripts that change these time stamps to intervals. However, on larger machines these timestamps start appearing many seconds, and even minutes into the boot process. This patch gets stick-frequency property early from OpenBoot, and uses its value to initialize time stamps before the first printk() messages are printed. Signed-off-by: Pavel Tatashin Reviewed-by: Shannon Nelson Reviewed-by: Steven Sistare --- arch/sparc/kernel/kernel.h | 3 +++ arch/sparc/kernel/setup_64.c | 1 + arch/sparc/kernel/time_64.c | 21 ++++++++------------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 6ae1e77..b625db4 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h @@ -52,6 +52,9 @@ static inline unsigned long kimage_addr_to_ra(const void *p) void do_signal32(struct pt_regs * regs); asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp); +/* time_64.c */ +void __init time_init_early(void); + /* compat_audit.c */ extern unsigned int sparc32_dir_class[]; extern unsigned int sparc32_chattr_class[]; diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 4a85f92..4d9c3e1 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -365,6 +365,7 @@ void __init start_early_boot(void) } current_thread_info()->cpu = cpu; + time_init_early(); prom_init_report(); start_kernel(); } diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index faec3f0..3acfea0 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c @@ -49,6 +49,7 @@ #include #include "entry.h" +#include "kernel.h" DEFINE_SPINLOCK(rtc_lock); @@ -258,9 +259,7 @@ static int stick_add_compare(unsigned long adj) static unsigned long stick_get_frequency(void) { - struct device_node *dp = of_find_node_by_path("/"); - - return of_getintprop_default(dp, "stick-frequency", 0); + return prom_getint(prom_root_node, "stick-frequency"); } static struct sparc64_tick_ops stick_operations __read_mostly = { @@ -792,10 +791,8 @@ static void init_tick_ops(struct sparc64_tick_ops *ops) tick_operations = *ops; } -void __init time_init(void) +void __init time_init_early(void) { - unsigned long freq; - if (tlb_type == spitfire) { if (is_hummingbird()) init_tick_ops(&hbtick_operations); @@ -804,17 +801,15 @@ void __init time_init(void) } else { init_tick_ops(&stick_operations); } +} + +void __init time_init(void) +{ + unsigned long freq; freq = tick_operations.frequency; tb_ticks_per_usec = freq / USEC_PER_SEC; - tick_operations.ticks_per_nsec_quotient = - clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); - - tick_operations.offset = (tick_operations.get_tick() - * tick_operations.ticks_per_nsec_quotient) - >> SPARC64_NSEC_PER_CYC_SHIFT; - clocksource_tick.name = tick_operations.name; clocksource_tick.read = clocksource_tick_read;