Skip to content

Commit 83e8eb9

Browse files
Pavel Tatashindavem330
authored andcommitted
sparc64: initialize time early
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>
1 parent 89108c3 commit 83e8eb9

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎arch/sparc/kernel/kernel.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs);
5252
void do_signal32(struct pt_regs * regs);
5353
asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
5454

55+
/* time_64.c */
56+
void __init time_init_early(void);
57+
5558
/* compat_audit.c */
5659
extern unsigned int sparc32_dir_class[];
5760
extern unsigned int sparc32_chattr_class[];

‎arch/sparc/kernel/setup_64.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ void __init start_early_boot(void)
365365
}
366366
current_thread_info()->cpu = cpu;
367367

368+
time_init_early();
368369
prom_init_report();
369370
start_kernel();
370371
}

‎arch/sparc/kernel/time_64.c‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include <asm/irq_regs.h>
5050

5151
#include "entry.h"
52+
#include "kernel.h"
5253

5354
DEFINE_SPINLOCK(rtc_lock);
5455

@@ -258,9 +259,7 @@ static int stick_add_compare(unsigned long adj)
258259

259260
static unsigned long stick_get_frequency(void)
260261
{
261-
struct device_node *dp = of_find_node_by_path("/");
262-
263-
return of_getintprop_default(dp, "stick-frequency", 0);
262+
return prom_getint(prom_root_node, "stick-frequency");
264263
}
265264

266265
static struct sparc64_tick_ops stick_operations __read_mostly = {
@@ -792,10 +791,8 @@ static void init_tick_ops(struct sparc64_tick_ops *ops)
792791
tick_operations = *ops;
793792
}
794793

795-
void __init time_init(void)
794+
void __init time_init_early(void)
796795
{
797-
unsigned long freq;
798-
799796
if (tlb_type == spitfire) {
800797
if (is_hummingbird())
801798
init_tick_ops(&hbtick_operations);
@@ -804,17 +801,15 @@ void __init time_init(void)
804801
} else {
805802
init_tick_ops(&stick_operations);
806803
}
804+
}
805+
806+
void __init time_init(void)
807+
{
808+
unsigned long freq;
807809

808810
freq = tick_operations.frequency;
809811
tb_ticks_per_usec = freq / USEC_PER_SEC;
810812

811-
tick_operations.ticks_per_nsec_quotient =
812-
clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
813-
814-
tick_operations.offset = (tick_operations.get_tick()
815-
* tick_operations.ticks_per_nsec_quotient)
816-
>> SPARC64_NSEC_PER_CYC_SHIFT;
817-
818813
clocksource_tick.name = tick_operations.name;
819814
clocksource_tick.read = clocksource_tick_read;
820815

0 commit comments

Comments
 (0)