diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-07-28 10:47:52 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-10-15 04:15:17 -0400 |
commit | 3807f345b2c610336c17c7624a0d496a38df75a0 (patch) | |
tree | 63142e06c85b938ddd6f1b0ced11724f362d6d5d /arch/x86/xen/time.c | |
parent | 3cf57fed216e2c1b6fdfeccb792650bab72a350a (diff) |
x86: paravirt: factor out cpu_khz to common code
KVM intends to use paravirt code to calibrate khz. Xen
current code will do just fine. So as a first step, factor out
code to pvclock.c.
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/xen/time.c')
-rw-r--r-- | arch/x86/xen/time.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 004ba86326ae..c9f7cda48ed7 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -198,17 +198,10 @@ unsigned long long xen_sched_clock(void) | |||
198 | /* Get the TSC speed from Xen */ | 198 | /* Get the TSC speed from Xen */ |
199 | unsigned long xen_tsc_khz(void) | 199 | unsigned long xen_tsc_khz(void) |
200 | { | 200 | { |
201 | u64 xen_khz = 1000000ULL << 32; | 201 | struct pvclock_vcpu_time_info *info = |
202 | const struct pvclock_vcpu_time_info *info = | ||
203 | &HYPERVISOR_shared_info->vcpu_info[0].time; | 202 | &HYPERVISOR_shared_info->vcpu_info[0].time; |
204 | 203 | ||
205 | do_div(xen_khz, info->tsc_to_system_mul); | 204 | return pvclock_tsc_khz(info); |
206 | if (info->tsc_shift < 0) | ||
207 | xen_khz <<= -info->tsc_shift; | ||
208 | else | ||
209 | xen_khz >>= info->tsc_shift; | ||
210 | |||
211 | return xen_khz; | ||
212 | } | 205 | } |
213 | 206 | ||
214 | cycle_t xen_clocksource_read(void) | 207 | cycle_t xen_clocksource_read(void) |