ia64/xen-unstable

changeset 18919:1391e1a444c2

x86: Clean up early time setup.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Dec 11 13:10:19 2008 +0000 (2008-12-11)
parents 33ae75b60de2
children df32584505c2
files xen/arch/x86/time.c
line diff
     1.1 --- a/xen/arch/x86/time.c	Thu Dec 11 13:09:59 2008 +0000
     1.2 +++ b/xen/arch/x86/time.c	Thu Dec 11 13:10:19 2008 +0000
     1.3 @@ -1125,19 +1125,19 @@ void init_percpu_time(void)
     1.4  /* Late init function (after all CPUs are booted). */
     1.5  int __init init_xen_time(void)
     1.6  {
     1.7 -    /* check if TSC is invariant during deep C state
     1.8 -       this is a new feature introduced by Nehalem*/
     1.9 +    /* Is TSC invariant during deep C state? */
    1.10      if ( cpuid_edx(0x80000007) & (1u<<8) )
    1.11          tsc_invariant = 1;
    1.12  
    1.13      open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration);
    1.14  
    1.15 -    init_percpu_time();
    1.16 +    /* NB. get_cmos_time() can take over one second to execute. */
    1.17 +    do_settime(get_cmos_time(), 0, NOW());
    1.18  
    1.19 -    stime_platform_stamp = 0;
    1.20 +    stime_platform_stamp = NOW();
    1.21      init_platform_timer();
    1.22  
    1.23 -    do_settime(get_cmos_time(), 0, NOW());
    1.24 +    init_percpu_time();
    1.25  
    1.26      return 0;
    1.27  }
    1.28 @@ -1146,9 +1146,12 @@ int __init init_xen_time(void)
    1.29  /* Early init function. */
    1.30  void __init early_time_init(void)
    1.31  {
    1.32 +    struct cpu_time *t = &this_cpu(cpu_time);
    1.33      u64 tmp = init_pit_and_calibrate_tsc();
    1.34  
    1.35 -    set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);
    1.36 +    /* So we can use get_s_time() during early boot. */
    1.37 +    set_time_scale(&t->tsc_scale, tmp);
    1.38 +    rdtscll(t->local_tsc_stamp);
    1.39  
    1.40      do_div(tmp, 1000);
    1.41      cpu_khz = (unsigned long)tmp;