]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: initialize time early
authorPavel Tatashin <pasha.tatashin@oracle.com>
Mon, 12 Jun 2017 20:41:46 +0000 (16:41 -0400)
committerAllen Pais <allen.pais@oracle.com>
Thu, 29 Jun 2017 08:09:43 +0000 (13:39 +0530)
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 <pasha.tatashin@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Reviewed-by: Steven Sistare <steven.sistare@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 24401250
Orabug: 25637776

(cherry picked from commit 83e8eb99d908da78e6eff7dd141f26626fe01d12)
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/kernel.h
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/time_64.c

index 44f32dd4477f5c644ac59d976f45d59095548bd2..6333ddc449a1637fad81387e82824bae5db45504 100644 (file)
@@ -52,6 +52,9 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
 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 sparc32_dir_class[];
 extern unsigned sparc32_chattr_class[];
index 2286e192ff8b1b88e9f02afb500fb7895f7e9780..410a09a107d610fdaf4187269507916048dfc7d0 100644 (file)
@@ -366,6 +366,7 @@ void __init start_early_boot(void)
        }
        current_thread_info()->cpu = cpu;
 
+       time_init_early();
        prom_init_report();
        start_kernel();
 }
index 081020194db0b69a8d3c3ddbcdfea1b44769b915..3d6a52e1a14a666d31f4921d67ecc85b89952699 100644 (file)
@@ -49,6 +49,7 @@
 #include <asm/irq_regs.h>
 
 #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 = {
@@ -805,10 +804,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);
@@ -817,17 +814,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;
        if (tlb_type == spitfire && is_hummingbird())