diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/time.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 66d2db7495aa..e5df167f7824 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -112,8 +112,9 @@ u64 ticklen_to_xs; /* 0.64 fraction */ | |||
112 | DEFINE_SPINLOCK(rtc_lock); | 112 | DEFINE_SPINLOCK(rtc_lock); |
113 | EXPORT_SYMBOL_GPL(rtc_lock); | 113 | EXPORT_SYMBOL_GPL(rtc_lock); |
114 | 114 | ||
115 | u64 tb_to_ns_scale; | 115 | static u64 tb_to_ns_scale __read_mostly; |
116 | unsigned tb_to_ns_shift; | 116 | static unsigned tb_to_ns_shift __read_mostly; |
117 | static unsigned long boot_tb __read_mostly; | ||
117 | 118 | ||
118 | struct gettimeofday_struct do_gtod; | 119 | struct gettimeofday_struct do_gtod; |
119 | 120 | ||
@@ -755,7 +756,7 @@ unsigned long long sched_clock(void) | |||
755 | { | 756 | { |
756 | if (__USE_RTC()) | 757 | if (__USE_RTC()) |
757 | return get_rtc(); | 758 | return get_rtc(); |
758 | return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift; | 759 | return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift; |
759 | } | 760 | } |
760 | 761 | ||
761 | int do_settimeofday(struct timespec *tv) | 762 | int do_settimeofday(struct timespec *tv) |
@@ -974,6 +975,8 @@ void __init time_init(void) | |||
974 | } | 975 | } |
975 | tb_to_ns_scale = scale; | 976 | tb_to_ns_scale = scale; |
976 | tb_to_ns_shift = shift; | 977 | tb_to_ns_shift = shift; |
978 | /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */ | ||
979 | boot_tb = get_tb(); | ||
977 | 980 | ||
978 | tm = get_boot_time(); | 981 | tm = get_boot_time(); |
979 | 982 | ||