diff options
author | Tony Breeds <tony@bakeyournoodle.com> | 2007-06-22 02:54:30 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-06-28 05:19:23 -0400 |
commit | 71712b455374a73af042fcfb5002fef5fd25ba44 (patch) | |
tree | 872c63855d0ca5c0dd2a8446cda4d6600415cc74 /arch/powerpc/kernel/time.c | |
parent | a5c631b174e23cab773cf422c1f39b28e7224602 (diff) |
[POWERPC] Move iSeries_tb_recal into its own late_initcall.
Currently iSeries will recalibrate the cputime_factors in the first
settimeofday() call.
It seems the reason for doing this is to ensure a resaonable time delta after
time_init(). On current kernels (with udev), this call is made 40-60 seconds
into the boot process, by moving it to a late initcall it is called
approximately 5 seconds after time_init() is called. This is sufficient to
recalibrate the timebase.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 43c687a1d76e..66d2db7495aa 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -77,9 +77,8 @@ | |||
77 | /* keep track of when we need to update the rtc */ | 77 | /* keep track of when we need to update the rtc */ |
78 | time_t last_rtc_update; | 78 | time_t last_rtc_update; |
79 | #ifdef CONFIG_PPC_ISERIES | 79 | #ifdef CONFIG_PPC_ISERIES |
80 | unsigned long iSeries_recal_titan = 0; | 80 | static unsigned long __initdata iSeries_recal_titan; |
81 | unsigned long iSeries_recal_tb = 0; | 81 | static signed long __initdata iSeries_recal_tb; |
82 | static unsigned long first_settimeofday = 1; | ||
83 | #endif | 82 | #endif |
84 | 83 | ||
85 | /* The decrementer counts down by 128 every 128ns on a 601. */ | 84 | /* The decrementer counts down by 128 every 128ns on a 601. */ |
@@ -556,10 +555,15 @@ EXPORT_SYMBOL(profile_pc); | |||
556 | * returned by the service processor for the timebase frequency. | 555 | * returned by the service processor for the timebase frequency. |
557 | */ | 556 | */ |
558 | 557 | ||
559 | static void iSeries_tb_recal(void) | 558 | static int __init iSeries_tb_recal(void) |
560 | { | 559 | { |
561 | struct div_result divres; | 560 | struct div_result divres; |
562 | unsigned long titan, tb; | 561 | unsigned long titan, tb; |
562 | |||
563 | /* Make sure we only run on iSeries */ | ||
564 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | ||
565 | return -ENODEV; | ||
566 | |||
563 | tb = get_tb(); | 567 | tb = get_tb(); |
564 | titan = HvCallXm_loadTod(); | 568 | titan = HvCallXm_loadTod(); |
565 | if ( iSeries_recal_titan ) { | 569 | if ( iSeries_recal_titan ) { |
@@ -600,8 +604,18 @@ static void iSeries_tb_recal(void) | |||
600 | } | 604 | } |
601 | iSeries_recal_titan = titan; | 605 | iSeries_recal_titan = titan; |
602 | iSeries_recal_tb = tb; | 606 | iSeries_recal_tb = tb; |
607 | |||
608 | return 0; | ||
603 | } | 609 | } |
604 | #endif | 610 | late_initcall(iSeries_tb_recal); |
611 | |||
612 | /* Called from platform early init */ | ||
613 | void __init iSeries_time_init_early(void) | ||
614 | { | ||
615 | iSeries_recal_tb = get_tb(); | ||
616 | iSeries_recal_titan = HvCallXm_loadTod(); | ||
617 | } | ||
618 | #endif /* CONFIG_PPC_ISERIES */ | ||
605 | 619 | ||
606 | /* | 620 | /* |
607 | * For iSeries shared processors, we have to let the hypervisor | 621 | * For iSeries shared processors, we have to let the hypervisor |
@@ -765,12 +779,6 @@ int do_settimeofday(struct timespec *tv) | |||
765 | * to the RTC again, or write to the RTC but then they don't call | 779 | * to the RTC again, or write to the RTC but then they don't call |
766 | * settimeofday to perform this operation. | 780 | * settimeofday to perform this operation. |
767 | */ | 781 | */ |
768 | #ifdef CONFIG_PPC_ISERIES | ||
769 | if (firmware_has_feature(FW_FEATURE_ISERIES) && first_settimeofday) { | ||
770 | iSeries_tb_recal(); | ||
771 | first_settimeofday = 0; | ||
772 | } | ||
773 | #endif | ||
774 | 782 | ||
775 | /* Make userspace gettimeofday spin until we're done. */ | 783 | /* Make userspace gettimeofday spin until we're done. */ |
776 | ++vdso_data->tb_update_count; | 784 | ++vdso_data->tb_update_count; |