diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-11-11 05:15:21 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-11-11 06:25:39 -0500 |
commit | a7f290dad32ee34d931561b7943c858fe2aae503 (patch) | |
tree | 850f04ed9ffba8aef6e151fa9c9e8a0c667bb795 /arch/powerpc/kernel/time.c | |
parent | 6761c4a07378e19e3710bb69cea65795774529b1 (diff) |
[PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel
This patch moves the vdso's to arch/powerpc, adds support for the 32
bits vdso to the 32 bits kernel, rename systemcfg (finally !), and adds
some new (still untested) routines to both vdso's: clock_gettime() with
support for CLOCK_REALTIME and CLOCK_MONOTONIC, clock_getres() (same
clocks) and get_tbfreq() for glibc to retreive the timebase frequency.
Tom,Steve: The implementation of get_tbfreq() I've done for 32 bits
returns a long long (r3, r4) not a long. This is such that if we ever
add support for >4Ghz timebases on ppc32, the userland interface won't
have to change.
I have tested gettimeofday() using some glibc patches in both ppc32 and
ppc64 kernels using 32 bits userland (I haven't had a chance to test a
64 bits userland yet, but the implementation didn't change and was
tested earlier). I haven't tested yet the new functions.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 260b6ecd26a9..070b4b458aaf 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -62,8 +62,8 @@ | |||
62 | #include <asm/irq.h> | 62 | #include <asm/irq.h> |
63 | #include <asm/div64.h> | 63 | #include <asm/div64.h> |
64 | #include <asm/smp.h> | 64 | #include <asm/smp.h> |
65 | #include <asm/vdso_datapage.h> | ||
65 | #ifdef CONFIG_PPC64 | 66 | #ifdef CONFIG_PPC64 |
66 | #include <asm/systemcfg.h> | ||
67 | #include <asm/firmware.h> | 67 | #include <asm/firmware.h> |
68 | #endif | 68 | #endif |
69 | #ifdef CONFIG_PPC_ISERIES | 69 | #ifdef CONFIG_PPC_ISERIES |
@@ -261,7 +261,6 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, | |||
261 | do_gtod.varp = temp_varp; | 261 | do_gtod.varp = temp_varp; |
262 | do_gtod.var_idx = temp_idx; | 262 | do_gtod.var_idx = temp_idx; |
263 | 263 | ||
264 | #ifdef CONFIG_PPC64 | ||
265 | /* | 264 | /* |
266 | * tb_update_count is used to allow the userspace gettimeofday code | 265 | * tb_update_count is used to allow the userspace gettimeofday code |
267 | * to assure itself that it sees a consistent view of the tb_to_xs and | 266 | * to assure itself that it sees a consistent view of the tb_to_xs and |
@@ -271,14 +270,15 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, | |||
271 | * tb_to_xs and stamp_xsec values are consistent. If not, then it | 270 | * tb_to_xs and stamp_xsec values are consistent. If not, then it |
272 | * loops back and reads them again until this criteria is met. | 271 | * loops back and reads them again until this criteria is met. |
273 | */ | 272 | */ |
274 | ++(_systemcfg->tb_update_count); | 273 | ++(vdso_data->tb_update_count); |
275 | smp_wmb(); | 274 | smp_wmb(); |
276 | _systemcfg->tb_orig_stamp = new_tb_stamp; | 275 | vdso_data->tb_orig_stamp = new_tb_stamp; |
277 | _systemcfg->stamp_xsec = new_stamp_xsec; | 276 | vdso_data->stamp_xsec = new_stamp_xsec; |
278 | _systemcfg->tb_to_xs = new_tb_to_xs; | 277 | vdso_data->tb_to_xs = new_tb_to_xs; |
278 | vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; | ||
279 | vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; | ||
279 | smp_wmb(); | 280 | smp_wmb(); |
280 | ++(_systemcfg->tb_update_count); | 281 | ++(vdso_data->tb_update_count); |
281 | #endif | ||
282 | } | 282 | } |
283 | 283 | ||
284 | /* | 284 | /* |
@@ -357,9 +357,8 @@ static void iSeries_tb_recal(void) | |||
357 | do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; | 357 | do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; |
358 | tb_to_xs = divres.result_low; | 358 | tb_to_xs = divres.result_low; |
359 | do_gtod.varp->tb_to_xs = tb_to_xs; | 359 | do_gtod.varp->tb_to_xs = tb_to_xs; |
360 | _systemcfg->tb_ticks_per_sec = | 360 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; |
361 | tb_ticks_per_sec; | 361 | vdso_data->tb_to_xs = tb_to_xs; |
362 | _systemcfg->tb_to_xs = tb_to_xs; | ||
363 | } | 362 | } |
364 | else { | 363 | else { |
365 | printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" | 364 | printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" |
@@ -561,10 +560,8 @@ int do_settimeofday(struct timespec *tv) | |||
561 | new_xsec += (u64)new_sec * XSEC_PER_SEC - tb_delta_xs; | 560 | new_xsec += (u64)new_sec * XSEC_PER_SEC - tb_delta_xs; |
562 | update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs); | 561 | update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs); |
563 | 562 | ||
564 | #ifdef CONFIG_PPC64 | 563 | vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; |
565 | _systemcfg->tz_minuteswest = sys_tz.tz_minuteswest; | 564 | vdso_data->tz_dsttime = sys_tz.tz_dsttime; |
566 | _systemcfg->tz_dsttime = sys_tz.tz_dsttime; | ||
567 | #endif | ||
568 | 565 | ||
569 | write_sequnlock_irqrestore(&xtime_lock, flags); | 566 | write_sequnlock_irqrestore(&xtime_lock, flags); |
570 | clock_was_set(); | 567 | clock_was_set(); |
@@ -713,13 +710,12 @@ void __init time_init(void) | |||
713 | do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; | 710 | do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; |
714 | do_gtod.varp->tb_to_xs = tb_to_xs; | 711 | do_gtod.varp->tb_to_xs = tb_to_xs; |
715 | do_gtod.tb_to_us = tb_to_us; | 712 | do_gtod.tb_to_us = tb_to_us; |
716 | #ifdef CONFIG_PPC64 | 713 | |
717 | _systemcfg->tb_orig_stamp = tb_last_jiffy; | 714 | vdso_data->tb_orig_stamp = tb_last_jiffy; |
718 | _systemcfg->tb_update_count = 0; | 715 | vdso_data->tb_update_count = 0; |
719 | _systemcfg->tb_ticks_per_sec = tb_ticks_per_sec; | 716 | vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; |
720 | _systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; | 717 | vdso_data->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; |
721 | _systemcfg->tb_to_xs = tb_to_xs; | 718 | vdso_data->tb_to_xs = tb_to_xs; |
722 | #endif | ||
723 | 719 | ||
724 | time_freq = 0; | 720 | time_freq = 0; |
725 | 721 | ||