diff options
-rw-r--r-- | arch/x86/kernel/time_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/tsc_32.c | 2 | ||||
-rw-r--r-- | include/linux/delay.h | 2 | ||||
-rw-r--r-- | init/calibrate.c | 36 |
4 files changed, 22 insertions, 20 deletions
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c index 12b4a71bd074..39ae8511a137 100644 --- a/arch/x86/kernel/time_64.c +++ b/arch/x86/kernel/time_64.c | |||
@@ -123,7 +123,7 @@ void __init time_init(void) | |||
123 | (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) | 123 | (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)) |
124 | cpu_khz = calculate_cpu_khz(); | 124 | cpu_khz = calculate_cpu_khz(); |
125 | 125 | ||
126 | lpj_tsc = ((unsigned long)tsc_khz * 1000)/HZ; | 126 | lpj_fine = ((unsigned long)tsc_khz * 1000)/HZ; |
127 | 127 | ||
128 | if (unsynchronized_tsc()) | 128 | if (unsynchronized_tsc()) |
129 | mark_tsc_unstable("TSCs unsynchronized"); | 129 | mark_tsc_unstable("TSCs unsynchronized"); |
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c index 0af49fb533e1..048baab77268 100644 --- a/arch/x86/kernel/tsc_32.c +++ b/arch/x86/kernel/tsc_32.c | |||
@@ -425,7 +425,7 @@ void __init tsc_init(void) | |||
425 | 425 | ||
426 | lpj = ((u64)tsc_khz * 1000); | 426 | lpj = ((u64)tsc_khz * 1000); |
427 | do_div(lpj, HZ); | 427 | do_div(lpj, HZ); |
428 | lpj_tsc = lpj; | 428 | lpj_fine = lpj; |
429 | 429 | ||
430 | printk("Detected %lu.%03lu MHz processor.\n", | 430 | printk("Detected %lu.%03lu MHz processor.\n", |
431 | (unsigned long)cpu_khz / 1000, | 431 | (unsigned long)cpu_khz / 1000, |
diff --git a/include/linux/delay.h b/include/linux/delay.h index 01aec60590ab..fd832c6d419e 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h | |||
@@ -41,7 +41,7 @@ static inline void ndelay(unsigned long x) | |||
41 | #define ndelay(x) ndelay(x) | 41 | #define ndelay(x) ndelay(x) |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | extern unsigned long lpj_tsc; | 44 | extern unsigned long lpj_fine; |
45 | void calibrate_delay(void); | 45 | void calibrate_delay(void); |
46 | void msleep(unsigned int msecs); | 46 | void msleep(unsigned int msecs); |
47 | unsigned long msleep_interruptible(unsigned int msecs); | 47 | unsigned long msleep_interruptible(unsigned int msecs); |
diff --git a/init/calibrate.c b/init/calibrate.c index 86286974dada..7963e3fc51d9 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/timex.h> | 10 | #include <linux/timex.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | 12 | ||
13 | unsigned long lpj_tsc; | 13 | unsigned long lpj_fine; |
14 | unsigned long preset_lpj; | 14 | unsigned long preset_lpj; |
15 | static int __init lpj_setup(char *str) | 15 | static int __init lpj_setup(char *str) |
16 | { | 16 | { |
@@ -35,9 +35,9 @@ static unsigned long __cpuinit calibrate_delay_direct(void) | |||
35 | unsigned long pre_start, start, post_start; | 35 | unsigned long pre_start, start, post_start; |
36 | unsigned long pre_end, end, post_end; | 36 | unsigned long pre_end, end, post_end; |
37 | unsigned long start_jiffies; | 37 | unsigned long start_jiffies; |
38 | unsigned long tsc_rate_min, tsc_rate_max; | 38 | unsigned long timer_rate_min, timer_rate_max; |
39 | unsigned long good_tsc_sum = 0; | 39 | unsigned long good_timer_sum = 0; |
40 | unsigned long good_tsc_count = 0; | 40 | unsigned long good_timer_count = 0; |
41 | int i; | 41 | int i; |
42 | 42 | ||
43 | if (read_current_timer(&pre_start) < 0 ) | 43 | if (read_current_timer(&pre_start) < 0 ) |
@@ -81,22 +81,24 @@ static unsigned long __cpuinit calibrate_delay_direct(void) | |||
81 | } | 81 | } |
82 | read_current_timer(&post_end); | 82 | read_current_timer(&post_end); |
83 | 83 | ||
84 | tsc_rate_max = (post_end - pre_start) / DELAY_CALIBRATION_TICKS; | 84 | timer_rate_max = (post_end - pre_start) / |
85 | tsc_rate_min = (pre_end - post_start) / DELAY_CALIBRATION_TICKS; | 85 | DELAY_CALIBRATION_TICKS; |
86 | timer_rate_min = (pre_end - post_start) / | ||
87 | DELAY_CALIBRATION_TICKS; | ||
86 | 88 | ||
87 | /* | 89 | /* |
88 | * If the upper limit and lower limit of the tsc_rate is | 90 | * If the upper limit and lower limit of the timer_rate is |
89 | * >= 12.5% apart, redo calibration. | 91 | * >= 12.5% apart, redo calibration. |
90 | */ | 92 | */ |
91 | if (pre_start != 0 && pre_end != 0 && | 93 | if (pre_start != 0 && pre_end != 0 && |
92 | (tsc_rate_max - tsc_rate_min) < (tsc_rate_max >> 3)) { | 94 | (timer_rate_max - timer_rate_min) < (timer_rate_max >> 3)) { |
93 | good_tsc_count++; | 95 | good_timer_count++; |
94 | good_tsc_sum += tsc_rate_max; | 96 | good_timer_sum += timer_rate_max; |
95 | } | 97 | } |
96 | } | 98 | } |
97 | 99 | ||
98 | if (good_tsc_count) | 100 | if (good_timer_count) |
99 | return (good_tsc_sum/good_tsc_count); | 101 | return (good_timer_sum/good_timer_count); |
100 | 102 | ||
101 | printk(KERN_WARNING "calibrate_delay_direct() failed to get a good " | 103 | printk(KERN_WARNING "calibrate_delay_direct() failed to get a good " |
102 | "estimate for loops_per_jiffy.\nProbably due to long platform interrupts. Consider using \"lpj=\" boot option.\n"); | 104 | "estimate for loops_per_jiffy.\nProbably due to long platform interrupts. Consider using \"lpj=\" boot option.\n"); |
@@ -111,8 +113,8 @@ static unsigned long __cpuinit calibrate_delay_direct(void) {return 0;} | |||
111 | * bit takes on average 1.5/HZ seconds. This (like the original) is a little | 113 | * bit takes on average 1.5/HZ seconds. This (like the original) is a little |
112 | * better than 1% | 114 | * better than 1% |
113 | * For the boot cpu we can skip the delay calibration and assign it a value | 115 | * For the boot cpu we can skip the delay calibration and assign it a value |
114 | * calculated based on the tsc frequency. | 116 | * calculated based on the timer frequency. |
115 | * For the rest of the CPUs we cannot assume that the tsc frequency is same as | 117 | * For the rest of the CPUs we cannot assume that the timer frequency is same as |
116 | * the cpu frequency, hence do the calibration for those. | 118 | * the cpu frequency, hence do the calibration for those. |
117 | */ | 119 | */ |
118 | #define LPS_PREC 8 | 120 | #define LPS_PREC 8 |
@@ -126,11 +128,11 @@ void __cpuinit calibrate_delay(void) | |||
126 | loops_per_jiffy = preset_lpj; | 128 | loops_per_jiffy = preset_lpj; |
127 | printk(KERN_INFO | 129 | printk(KERN_INFO |
128 | "Calibrating delay loop (skipped) preset value.. "); | 130 | "Calibrating delay loop (skipped) preset value.. "); |
129 | } else if ((smp_processor_id() == 0) && lpj_tsc) { | 131 | } else if ((smp_processor_id() == 0) && lpj_fine) { |
130 | loops_per_jiffy = lpj_tsc; | 132 | loops_per_jiffy = lpj_fine; |
131 | printk(KERN_INFO | 133 | printk(KERN_INFO |
132 | "Calibrating delay loop (skipped), " | 134 | "Calibrating delay loop (skipped), " |
133 | "using tsc calculated value.. "); | 135 | "value calculated using timer frequency.. "); |
134 | } else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) { | 136 | } else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) { |
135 | printk(KERN_INFO | 137 | printk(KERN_INFO |
136 | "Calibrating delay using timer specific routine.. "); | 138 | "Calibrating delay using timer specific routine.. "); |