diff options
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bc96ac9ed912..bdba1d09a97e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <asm/i387.h> | 56 | #include <asm/i387.h> |
57 | #include <asm/xcr.h> | 57 | #include <asm/xcr.h> |
58 | #include <asm/pvclock.h> | 58 | #include <asm/pvclock.h> |
59 | #include <asm/div64.h> | ||
59 | 60 | ||
60 | #define MAX_IO_MSRS 256 | 61 | #define MAX_IO_MSRS 256 |
61 | #define CR0_RESERVED_BITS \ | 62 | #define CR0_RESERVED_BITS \ |
@@ -917,11 +918,15 @@ static inline int kvm_tsc_changes_freq(void) | |||
917 | 918 | ||
918 | static inline u64 nsec_to_cycles(u64 nsec) | 919 | static inline u64 nsec_to_cycles(u64 nsec) |
919 | { | 920 | { |
921 | u64 ret; | ||
922 | |||
920 | WARN_ON(preemptible()); | 923 | WARN_ON(preemptible()); |
921 | if (kvm_tsc_changes_freq()) | 924 | if (kvm_tsc_changes_freq()) |
922 | printk_once(KERN_WARNING | 925 | printk_once(KERN_WARNING |
923 | "kvm: unreliable cycle conversion on adjustable rate TSC\n"); | 926 | "kvm: unreliable cycle conversion on adjustable rate TSC\n"); |
924 | return (nsec * __get_cpu_var(cpu_tsc_khz)) / USEC_PER_SEC; | 927 | ret = nsec * __get_cpu_var(cpu_tsc_khz); |
928 | do_div(ret, USEC_PER_SEC); | ||
929 | return ret; | ||
925 | } | 930 | } |
926 | 931 | ||
927 | void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) | 932 | void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) |