Commit e93ef949fd9a3f237aedfb8e64414b28980530b8
Committed by
Ingo Molnar
1 parent
8fbbc4b45c
Exists in
master
and in
4 other branches
x86: rename paravirtualized TSC functions
Rename the paravirtualized calculate_cpu_khz to calibrate_tsc. In all cases, we actually calibrate_tsc and use that as the cpu_khz value. 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>
Showing 11 changed files with 22 additions and 26 deletions Side-by-side Diff
arch/x86/kernel/paravirt.c
... | ... | @@ -285,7 +285,7 @@ |
285 | 285 | .get_wallclock = native_get_wallclock, |
286 | 286 | .set_wallclock = native_set_wallclock, |
287 | 287 | .sched_clock = native_sched_clock, |
288 | - .get_cpu_khz = native_calculate_cpu_khz, | |
288 | + .get_tsc_khz = native_calibrate_tsc, | |
289 | 289 | }; |
290 | 290 | |
291 | 291 | struct pv_irq_ops pv_irq_ops = { |
arch/x86/kernel/tsc.c
... | ... | @@ -123,9 +123,9 @@ |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * tsc_calibrate - calibrate the tsc on boot | |
126 | + * native_calibrate_tsc - calibrate the tsc on boot | |
127 | 127 | */ |
128 | -static unsigned int __init tsc_calibrate(void) | |
128 | +unsigned long native_calibrate_tsc(void) | |
129 | 129 | { |
130 | 130 | unsigned long flags; |
131 | 131 | u64 tsc1, tsc2, tr1, tr2, delta, pm1, pm2, hpet1, hpet2; |
... | ... | @@ -195,10 +195,6 @@ |
195 | 195 | return tsc_khz_val; |
196 | 196 | } |
197 | 197 | |
198 | -unsigned long native_calculate_cpu_khz(void) | |
199 | -{ | |
200 | - return tsc_calibrate(); | |
201 | -} | |
202 | 198 | |
203 | 199 | #ifdef CONFIG_X86_32 |
204 | 200 | /* Only called from the Powernow K7 cpu freq driver */ |
... | ... | @@ -208,8 +204,8 @@ |
208 | 204 | unsigned long cpu_khz_old = cpu_khz; |
209 | 205 | |
210 | 206 | if (cpu_has_tsc) { |
211 | - cpu_khz = calculate_cpu_khz(); | |
212 | - tsc_khz = cpu_khz; | |
207 | + tsc_khz = calibrate_tsc(); | |
208 | + cpu_khz = tsc_khz; | |
213 | 209 | cpu_data(0).loops_per_jiffy = |
214 | 210 | cpufreq_scale(cpu_data(0).loops_per_jiffy, |
215 | 211 | cpu_khz_old, cpu_khz); |
216 | 212 | |
... | ... | @@ -487,10 +483,10 @@ |
487 | 483 | if (!cpu_has_tsc) |
488 | 484 | return; |
489 | 485 | |
490 | - cpu_khz = calculate_cpu_khz(); | |
491 | - tsc_khz = cpu_khz; | |
486 | + tsc_khz = calibrate_tsc(); | |
487 | + cpu_khz = tsc_khz; | |
492 | 488 | |
493 | - if (!cpu_khz) { | |
489 | + if (!tsc_khz) { | |
494 | 490 | mark_tsc_unstable("could not calculate TSC khz"); |
495 | 491 | return; |
496 | 492 | } |
arch/x86/kernel/vmi_32.c
... | ... | @@ -932,7 +932,7 @@ |
932 | 932 | pv_apic_ops.setup_secondary_clock = vmi_time_ap_init; |
933 | 933 | #endif |
934 | 934 | pv_time_ops.sched_clock = vmi_sched_clock; |
935 | - pv_time_ops.get_cpu_khz = vmi_cpu_khz; | |
935 | + pv_time_ops.get_tsc_khz = vmi_tsc_khz; | |
936 | 936 | |
937 | 937 | /* We have true wallclock functions; disable CMOS clock sync */ |
938 | 938 | no_sync_cmos_clock = 1; |
arch/x86/kernel/vmiclock_32.c
... | ... | @@ -69,8 +69,8 @@ |
69 | 69 | return cycles_2_ns(vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE)); |
70 | 70 | } |
71 | 71 | |
72 | -/* paravirt_ops.get_cpu_khz = vmi_cpu_khz */ | |
73 | -unsigned long vmi_cpu_khz(void) | |
72 | +/* paravirt_ops.get_tsc_khz = vmi_tsc_khz */ | |
73 | +unsigned long vmi_tsc_khz(void) | |
74 | 74 | { |
75 | 75 | unsigned long long khz; |
76 | 76 | khz = vmi_timer_ops.get_cycle_frequency(); |
arch/x86/lguest/boot.c
... | ... | @@ -607,7 +607,7 @@ |
607 | 607 | * what speed it runs at, or 0 if it's unusable as a reliable clock source. |
608 | 608 | * This matches what we want here: if we return 0 from this function, the x86 |
609 | 609 | * TSC clock will give up and not register itself. */ |
610 | -static unsigned long lguest_cpu_khz(void) | |
610 | +static unsigned long lguest_tsc_khz(void) | |
611 | 611 | { |
612 | 612 | return lguest_data.tsc_khz; |
613 | 613 | } |
... | ... | @@ -998,7 +998,7 @@ |
998 | 998 | /* time operations */ |
999 | 999 | pv_time_ops.get_wallclock = lguest_get_wallclock; |
1000 | 1000 | pv_time_ops.time_init = lguest_time_init; |
1001 | - pv_time_ops.get_cpu_khz = lguest_cpu_khz; | |
1001 | + pv_time_ops.get_tsc_khz = lguest_tsc_khz; | |
1002 | 1002 | |
1003 | 1003 | /* Now is a good time to look at the implementations of these functions |
1004 | 1004 | * before returning to the rest of lguest_init(). */ |
arch/x86/xen/enlighten.c
arch/x86/xen/time.c
... | ... | @@ -197,8 +197,8 @@ |
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | -/* Get the CPU speed from Xen */ | |
201 | -unsigned long xen_cpu_khz(void) | |
200 | +/* Get the TSC speed from Xen */ | |
201 | +unsigned long xen_tsc_khz(void) | |
202 | 202 | { |
203 | 203 | u64 xen_khz = 1000000ULL << 32; |
204 | 204 | const struct pvclock_vcpu_time_info *info = |
arch/x86/xen/xen-ops.h
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | |
33 | 33 | void xen_setup_timer(int cpu); |
34 | 34 | void xen_setup_cpu_clockevents(void); |
35 | -unsigned long xen_cpu_khz(void); | |
35 | +unsigned long xen_tsc_khz(void); | |
36 | 36 | void __init xen_time_init(void); |
37 | 37 | unsigned long xen_get_wallclock(void); |
38 | 38 | int xen_set_wallclock(unsigned long time); |
include/asm-x86/paravirt.h
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | int (*set_wallclock)(unsigned long); |
85 | 85 | |
86 | 86 | unsigned long long (*sched_clock)(void); |
87 | - unsigned long (*get_cpu_khz)(void); | |
87 | + unsigned long (*get_tsc_khz)(void); | |
88 | 88 | }; |
89 | 89 | |
90 | 90 | struct pv_cpu_ops { |
... | ... | @@ -779,7 +779,7 @@ |
779 | 779 | { |
780 | 780 | return PVOP_CALL0(unsigned long long, pv_time_ops.sched_clock); |
781 | 781 | } |
782 | -#define calculate_cpu_khz() (pv_time_ops.get_cpu_khz()) | |
782 | +#define calibrate_tsc() (pv_time_ops.get_tsc_khz()) | |
783 | 783 | |
784 | 784 | static inline unsigned long long paravirt_read_pmc(int counter) |
785 | 785 | { |
include/asm-x86/timer.h
... | ... | @@ -7,14 +7,14 @@ |
7 | 7 | #define TICK_SIZE (tick_nsec / 1000) |
8 | 8 | |
9 | 9 | unsigned long long native_sched_clock(void); |
10 | -unsigned long native_calculate_cpu_khz(void); | |
10 | +unsigned long native_calibrate_tsc(void); | |
11 | 11 | |
12 | 12 | extern int timer_ack; |
13 | 13 | extern int no_timer_check; |
14 | 14 | extern int recalibrate_cpu_khz(void); |
15 | 15 | |
16 | 16 | #ifndef CONFIG_PARAVIRT |
17 | -#define calculate_cpu_khz() native_calculate_cpu_khz() | |
17 | +#define calibrate_tsc() native_calibrate_tsc() | |
18 | 18 | #endif |
19 | 19 | |
20 | 20 | /* Accelerators for sched_clock() |
include/asm-x86/vmi_time.h
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 | extern unsigned long vmi_get_wallclock(void); |
51 | 51 | extern int vmi_set_wallclock(unsigned long now); |
52 | 52 | extern unsigned long long vmi_sched_clock(void); |
53 | -extern unsigned long vmi_cpu_khz(void); | |
53 | +extern unsigned long vmi_tsc_khz(void); | |
54 | 54 | |
55 | 55 | #ifdef CONFIG_X86_LOCAL_APIC |
56 | 56 | extern void __devinit vmi_time_bsp_init(void); |