diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-04-14 09:36:28 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-04-14 09:37:27 -0400 |
commit | b6112ccbff5ec580d46b584ecc3c3a773b830da2 (patch) | |
tree | 71553f09a2acfedec85f3c29a1c65e0a257001fb /arch/s390/kernel/time.c | |
parent | 5b409ed17bb32c8316b1f456466c70529454573a (diff) |
[S390] add read_persistent_clock
Add a read_persistent_clock function that does not just return 0.
Since timekeeping_init calls the function before time_init has been
called move reset_tod_clock to early.c to make sure that the TOD
clock is running when read_persistent_clock is invoked.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/time.c')
-rw-r--r-- | arch/s390/kernel/time.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 05f93e77870b..369ff02c4ab2 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -52,9 +52,6 @@ | |||
52 | #define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) | 52 | #define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) |
53 | #define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) | 53 | #define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) |
54 | 54 | ||
55 | /* The value of the TOD clock for 1.1.1970. */ | ||
56 | #define TOD_UNIX_EPOCH 0x7d91048bca000000ULL | ||
57 | |||
58 | /* | 55 | /* |
59 | * Create a small time difference between the timer interrupts | 56 | * Create a small time difference between the timer interrupts |
60 | * on the different cpus to avoid lock contention. | 57 | * on the different cpus to avoid lock contention. |
@@ -63,9 +60,10 @@ | |||
63 | 60 | ||
64 | #define TICK_SIZE tick | 61 | #define TICK_SIZE tick |
65 | 62 | ||
63 | u64 sched_clock_base_cc = -1; /* Force to data section. */ | ||
64 | |||
66 | static ext_int_info_t ext_int_info_cc; | 65 | static ext_int_info_t ext_int_info_cc; |
67 | static ext_int_info_t ext_int_etr_cc; | 66 | static ext_int_info_t ext_int_etr_cc; |
68 | static u64 sched_clock_base_cc; | ||
69 | 67 | ||
70 | static DEFINE_PER_CPU(struct clock_event_device, comparators); | 68 | static DEFINE_PER_CPU(struct clock_event_device, comparators); |
71 | 69 | ||
@@ -195,22 +193,12 @@ static void timing_alert_interrupt(__u16 code) | |||
195 | static void etr_reset(void); | 193 | static void etr_reset(void); |
196 | static void stp_reset(void); | 194 | static void stp_reset(void); |
197 | 195 | ||
198 | /* | 196 | unsigned long read_persistent_clock(void) |
199 | * Get the TOD clock running. | ||
200 | */ | ||
201 | static u64 __init reset_tod_clock(void) | ||
202 | { | 197 | { |
203 | u64 time; | 198 | struct timespec ts; |
204 | 199 | ||
205 | etr_reset(); | 200 | tod_to_timeval(get_clock() - TOD_UNIX_EPOCH, &ts); |
206 | stp_reset(); | 201 | return ts.tv_sec; |
207 | if (store_clock(&time) == 0) | ||
208 | return time; | ||
209 | /* TOD clock not running. Set the clock to Unix Epoch. */ | ||
210 | if (set_clock(TOD_UNIX_EPOCH) != 0 || store_clock(&time) != 0) | ||
211 | panic("TOD clock not operational."); | ||
212 | |||
213 | return TOD_UNIX_EPOCH; | ||
214 | } | 202 | } |
215 | 203 | ||
216 | static cycle_t read_tod_clock(void) | 204 | static cycle_t read_tod_clock(void) |
@@ -265,7 +253,9 @@ void update_vsyscall_tz(void) | |||
265 | */ | 253 | */ |
266 | void __init time_init(void) | 254 | void __init time_init(void) |
267 | { | 255 | { |
268 | sched_clock_base_cc = reset_tod_clock(); | 256 | /* Reset time synchronization interfaces. */ |
257 | etr_reset(); | ||
258 | stp_reset(); | ||
269 | 259 | ||
270 | /* set xtime */ | 260 | /* set xtime */ |
271 | tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &xtime); | 261 | tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, &xtime); |