Commit e93353c9 authored by Eduardo Habkost's avatar Eduardo Habkost Committed by Avi Kivity

x86: KVM guest: kvm_get_tsc_khz: return khz, not lpj

kvm_get_tsc_khz() currently returns the previously-calculated preset_lpj
value, but it is in loops-per-jiffy, not kHz. The current code works
correctly only when HZ=1000.
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent ad218f85
...@@ -89,17 +89,17 @@ static cycle_t kvm_clock_read(void) ...@@ -89,17 +89,17 @@ static cycle_t kvm_clock_read(void)
*/ */
static unsigned long kvm_get_tsc_khz(void) static unsigned long kvm_get_tsc_khz(void)
{ {
return preset_lpj; struct pvclock_vcpu_time_info *src;
src = &per_cpu(hv_clock, 0);
return pvclock_tsc_khz(src);
} }
static void kvm_get_preset_lpj(void) static void kvm_get_preset_lpj(void)
{ {
struct pvclock_vcpu_time_info *src;
unsigned long khz; unsigned long khz;
u64 lpj; u64 lpj;
src = &per_cpu(hv_clock, 0); khz = kvm_get_tsc_khz();
khz = pvclock_tsc_khz(src);
lpj = ((u64)khz * 1000); lpj = ((u64)khz * 1000);
do_div(lpj, HZ); do_div(lpj, HZ);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment