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>
This commit is contained in:

committed by
Ingo Molnar

parent
0ef9553332
commit
bfc0f5947a
@@ -56,7 +56,7 @@ static irqreturn_t timer_event_interrupt(int irq, void *dev_id)
|
||||
/* calibrate_cpu is used on systems with fixed rate TSCs to determine
|
||||
* processor frequency */
|
||||
#define TICK_COUNT 100000000
|
||||
unsigned long __init native_calculate_cpu_khz(void)
|
||||
static unsigned long __init calibrate_cpu(void)
|
||||
{
|
||||
int tsc_start, tsc_now;
|
||||
int i, no_ctr_free;
|
||||
@@ -114,14 +114,18 @@ void __init hpet_time_init(void)
|
||||
setup_irq(0, &irq0);
|
||||
}
|
||||
|
||||
extern void set_cyc2ns_scale(unsigned long cpu_khz, int cpu);
|
||||
|
||||
void __init time_init(void)
|
||||
{
|
||||
tsc_calibrate();
|
||||
int cpu;
|
||||
|
||||
cpu_khz = calculate_cpu_khz();
|
||||
tsc_khz = cpu_khz;
|
||||
|
||||
cpu_khz = tsc_khz;
|
||||
if (cpu_has(&boot_cpu_data, X86_FEATURE_CONSTANT_TSC) &&
|
||||
(boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
|
||||
cpu_khz = calculate_cpu_khz();
|
||||
(boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
|
||||
cpu_khz = calibrate_cpu();
|
||||
|
||||
lpj_fine = ((unsigned long)tsc_khz * 1000)/HZ;
|
||||
|
||||
@@ -134,7 +138,17 @@ void __init time_init(void)
|
||||
vgetcpu_mode = VGETCPU_LSL;
|
||||
|
||||
printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n",
|
||||
cpu_khz / 1000, cpu_khz % 1000);
|
||||
cpu_khz / 1000, cpu_khz % 1000);
|
||||
|
||||
/*
|
||||
* Secondary CPUs do not run through tsc_init(), so set up
|
||||
* all the scale factors for all CPUs, assuming the same
|
||||
* speed as the bootup CPU. (cpufreq notifiers will fix this
|
||||
* up if their speed diverges)
|
||||
*/
|
||||
for_each_possible_cpu(cpu)
|
||||
set_cyc2ns_scale(cpu_khz, cpu);
|
||||
|
||||
init_tsc_clocksource();
|
||||
late_time_init = choose_time_init();
|
||||
}
|
||||
|
Reference in New Issue
Block a user