diff options
author | Alok Kataria <akataria@vmware.com> | 2008-07-01 14:43:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-09 01:43:25 -0400 |
commit | bfc0f5947afa5e3a13e55867f4478c8a92c11dca (patch) | |
tree | bb642adee69c7804eaafbb7fad66af61b4f9f56f /arch/x86/kernel/time_64.c | |
parent | 0ef95533326a7b37d16025af9edc0c18e644b346 (diff) |
x86: merge tsc calibration
Merge the tsc calibration code for the 32bit and 64bit kernel.
The paravirtualized calculate_cpu_khz for 64bit now points to the correct
tsc_calibrate code as in 32bit.
Original native_calculate_cpu_khz for 64 bit is now called as calibrate_cpu.
Also moved the recalibrate_cpu_khz function in the common file.
Note that this function is called only from powernow K7 cpu freq driver.
Signed-off-by: Alok N Kataria <akataria@vmware.com>
Signed-off-by: Dan Hecht <dhecht@vmware.com>
Cc: Dan Hecht <dhecht@vmware.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/time_64.c')
-rw-r--r-- | arch/x86/kernel/time_64.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c index 39ae8511a137..c6ac4dad41f6 100644 --- a/arch/x86/kernel/time_64.c +++ b/arch/x86/kernel/time_64.c | |||
@@ -56,7 +56,7 @@ static irqreturn_t timer_event_interrupt(int irq, void *dev_id) | |||
56 | /* calibrate_cpu is used on systems with fixed rate TSCs to determine | 56 | /* calibrate_cpu is used on systems with fixed rate TSCs to determine |
57 | * processor frequency */ | 57 | * processor frequency */ |
58 | #define TICK_COUNT 100000000 | 58 | #define TICK_COUNT 100000000 |
59 | unsigned long __init native_calculate_cpu_khz(void) | 59 | static unsigned long __init calibrate_cpu(void) |
60 | { | 60 | { |
61 | int tsc_start, tsc_now; | 61 | int tsc_start, tsc_now; |
62 | int i, no_ctr_free; | 62 | int i, no_ctr_free; |
@@ -114,14 +114,18 @@ void __init hpet_time_init(void) | |||
114 | setup_irq(0, &irq0); | 114 | setup_irq(0, &irq0); |
115 | } | 115 | } |
116 | 116 | ||
117 | extern void set_cyc2ns_scale(unsigned long cpu_khz, int cpu); | ||
118 | |||
117 | void __init time_init(void) | 119 | void __init time_init(void) |
118 | { | 120 | { |
119 | tsc_calibrate(); | 121 | int cpu; |
122 | |||
123 | cpu_khz = calculate_cpu_khz(); | ||
124 | tsc_khz = cpu_khz; | ||
120 | 125 | ||
121 | cpu_khz = tsc_khz; | ||
122 | if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) && | 126 | if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) && |
123 | (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) | 127 | (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) |
124 | cpu_khz = calculate_cpu_khz(); | 128 | cpu_khz = calibrate_cpu(); |
125 | 129 | ||
126 | lpj_fine = ((unsigned long)tsc_khz * 1000)/HZ; | 130 | lpj_fine = ((unsigned long)tsc_khz * 1000)/HZ; |
127 | 131 | ||
@@ -134,7 +138,17 @@ void __init time_init(void) | |||
134 | vgetcpu_mode = VGETCPU_LSL; | 138 | vgetcpu_mode = VGETCPU_LSL; |
135 | 139 | ||
136 | printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", | 140 | printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", |
137 | cpu_khz / 1000, cpu_khz % 1000); | 141 | cpu_khz / 1000, cpu_khz % 1000); |
142 | |||
143 | /* | ||
144 | * Secondary CPUs do not run through tsc_init(), so set up | ||
145 | * all the scale factors for all CPUs, assuming the same | ||
146 | * speed as the bootup CPU. (cpufreq notifiers will fix this | ||
147 | * up if their speed diverges) | ||
148 | */ | ||
149 | for_each_possible_cpu(cpu) | ||
150 | set_cyc2ns_scale(cpu_khz, cpu); | ||
151 | |||
138 | init_tsc_clocksource(); | 152 | init_tsc_clocksource(); |
139 | late_time_init = choose_time_init(); | 153 | late_time_init = choose_time_init(); |
140 | } | 154 | } |