aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/time.c')
-rw-r--r--arch/s390/kernel/time.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index e76c2e7a8b9a..a94ec48587b4 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -182,12 +182,9 @@ static void timing_alert_interrupt(__u16 code)
182static void etr_reset(void); 182static void etr_reset(void);
183static void stp_reset(void); 183static void stp_reset(void);
184 184
185unsigned long read_persistent_clock(void) 185void read_persistent_clock(struct timespec *ts)
186{ 186{
187 struct timespec ts; 187 tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, ts);
188
189 tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, &ts);
190 return ts.tv_sec;
191} 188}
192 189
193static cycle_t read_tod_clock(struct clocksource *cs) 190static cycle_t read_tod_clock(struct clocksource *cs)
@@ -248,7 +245,6 @@ void __init time_init(void)
248{ 245{
249 struct timespec ts; 246 struct timespec ts;
250 unsigned long flags; 247 unsigned long flags;
251 cycle_t now;
252 248
253 /* Reset time synchronization interfaces. */ 249 /* Reset time synchronization interfaces. */
254 etr_reset(); 250 etr_reset();
@@ -266,20 +262,10 @@ void __init time_init(void)
266 panic("Could not register TOD clock source"); 262 panic("Could not register TOD clock source");
267 263
268 /* 264 /*
269 * The TOD clock is an accurate clock. The xtime should be 265 * Reset wall_to_monotonic to the initial timestamp created
270 * initialized in a way that the difference between TOD and 266 * in head.S to get a precise value in /proc/uptime.
271 * xtime is reasonably small. Too bad that timekeeping_init
272 * sets xtime.tv_nsec to zero. In addition the clock source
273 * change from the jiffies clock source to the TOD clock
274 * source add another error of up to 1/HZ second. The same
275 * function sets wall_to_monotonic to a value that is too
276 * small for /proc/uptime to be accurate.
277 * Reset xtime and wall_to_monotonic to sane values.
278 */ 267 */
279 write_seqlock_irqsave(&xtime_lock, flags); 268 write_seqlock_irqsave(&xtime_lock, flags);
280 now = get_clock();
281 tod_to_timeval(now - TOD_UNIX_EPOCH, &xtime);
282 clocksource_tod.cycle_last = now;
283 tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &ts); 269 tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &ts);
284 set_normalized_timespec(&wall_to_monotonic, -ts.tv_sec, -ts.tv_nsec); 270 set_normalized_timespec(&wall_to_monotonic, -ts.tv_sec, -ts.tv_nsec);
285 write_sequnlock_irqrestore(&xtime_lock, flags); 271 write_sequnlock_irqrestore(&xtime_lock, flags);