diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-08-14 09:47:32 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-08-15 04:55:47 -0400 |
commit | 23970e389e9cee43c4b41023935e1417271708b2 (patch) | |
tree | d97d299cf74c44cf7ceb4c04c82dafc451fbbfbb /arch/s390/kernel/time.c | |
parent | d4f587c67fc39e0030ddd718675e252e208da4d7 (diff) |
timekeeping: Introduce read_boot_clock
Add the new function read_boot_clock to get the exact time the system
has been started. For architectures without support for exact boot
time a new weak function is added that returns 0. Use the exact boot
time to initialize wall_to_monotonic, or xtime if the read_boot_clock
returned 0.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: John Stultz <johnstul@us.ibm.com>
Cc: Daniel Walker <dwalker@fifo99.com>
LKML-Reference: <20090814134811.296703241@de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/s390/kernel/time.c')
-rw-r--r-- | arch/s390/kernel/time.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index a94ec48587b4..6bff1a1d9060 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -187,6 +187,11 @@ void read_persistent_clock(struct timespec *ts) | |||
187 | tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, ts); | 187 | tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, ts); |
188 | } | 188 | } |
189 | 189 | ||
190 | void read_boot_clock(struct timespec *ts) | ||
191 | { | ||
192 | tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, ts); | ||
193 | } | ||
194 | |||
190 | static cycle_t read_tod_clock(struct clocksource *cs) | 195 | static cycle_t read_tod_clock(struct clocksource *cs) |
191 | { | 196 | { |
192 | return get_clock(); | 197 | return get_clock(); |
@@ -243,9 +248,6 @@ void update_vsyscall_tz(void) | |||
243 | */ | 248 | */ |
244 | void __init time_init(void) | 249 | void __init time_init(void) |
245 | { | 250 | { |
246 | struct timespec ts; | ||
247 | unsigned long flags; | ||
248 | |||
249 | /* Reset time synchronization interfaces. */ | 251 | /* Reset time synchronization interfaces. */ |
250 | etr_reset(); | 252 | etr_reset(); |
251 | stp_reset(); | 253 | stp_reset(); |
@@ -261,15 +263,6 @@ void __init time_init(void) | |||
261 | if (clocksource_register(&clocksource_tod) != 0) | 263 | if (clocksource_register(&clocksource_tod) != 0) |
262 | panic("Could not register TOD clock source"); | 264 | panic("Could not register TOD clock source"); |
263 | 265 | ||
264 | /* | ||
265 | * Reset wall_to_monotonic to the initial timestamp created | ||
266 | * in head.S to get a precise value in /proc/uptime. | ||
267 | */ | ||
268 | write_seqlock_irqsave(&xtime_lock, flags); | ||
269 | tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &ts); | ||
270 | set_normalized_timespec(&wall_to_monotonic, -ts.tv_sec, -ts.tv_nsec); | ||
271 | write_sequnlock_irqrestore(&xtime_lock, flags); | ||
272 | |||
273 | /* Enable TOD clock interrupts on the boot cpu. */ | 266 | /* Enable TOD clock interrupts on the boot cpu. */ |
274 | init_cpu_timer(); | 267 | init_cpu_timer(); |
275 | 268 | ||