diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2012-11-28 01:28:51 (GMT) |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-11-28 01:29:07 (GMT) |
commit | dce2db0a35197e2f4421245079f19ab753e97348 (patch) | |
tree | c3151bef0ca980cf1c1af1fa6c4585df41e5a760 /arch/x86/kernel/pvclock.c | |
parent | 42b5637d6989f75a7a0e8ea8633583564ff443ff (diff) | |
download | linux-fsl-qoriq-dce2db0a35197e2f4421245079f19ab753e97348.tar.xz |
x86: pvclock: create helper for pvclock data retrieval
Originally from Jeremy Fitzhardinge.
So code can be reused.
Acked-by: Glauber Costa <glommer@parallels.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kernel/pvclock.c')
-rw-r--r-- | arch/x86/kernel/pvclock.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c index d59e606..a7d9091 100644 --- a/arch/x86/kernel/pvclock.c +++ b/arch/x86/kernel/pvclock.c @@ -26,13 +26,6 @@ void pvclock_set_flags(u8 flags) valid_flags = flags; } -static u64 pvclock_get_nsec_offset(const struct pvclock_vcpu_time_info *src) -{ - u64 delta = native_read_tsc() - src->tsc_timestamp; - return pvclock_scale_delta(delta, src->tsc_to_system_mul, - src->tsc_shift); -} - unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src) { u64 pv_tsc_khz = 1000000ULL << 32; @@ -55,17 +48,12 @@ void pvclock_resume(void) cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) { unsigned version; - cycle_t ret, offset; + cycle_t ret; u64 last; u8 flags; do { - version = src->version; - rdtsc_barrier(); - offset = pvclock_get_nsec_offset(src); - ret = src->system_time + offset; - flags = src->flags; - rdtsc_barrier(); + version = __pvclock_read_cycles(src, &ret, &flags); } while ((src->version & 1) || version != src->version); if ((valid_flags & PVCLOCK_TSC_STABLE_BIT) && |