diff options
author | Avi Kivity <avi@redhat.com> | 2010-08-26 13:38:03 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 10:51:43 +0200 |
commit | 217fc9cfca21a0bc2f4246183ebd8ee9863b019d (patch) | |
tree | 905be9d9db39e189ecf7221d520646cf18b7b4b4 | |
parent | 34d1f4905eb66478a890ea808ec58bc842e6e589 (diff) | |
download | blackbird-op-linux-217fc9cfca21a0bc2f4246183ebd8ee9863b019d.tar.gz blackbird-op-linux-217fc9cfca21a0bc2f4246183ebd8ee9863b019d.zip |
KVM: Fix build error due to 64-bit division in nsec_to_cycles()
Use do_div() instead.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-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 @@ #include <asm/i387.h> #include <asm/xcr.h> #include <asm/pvclock.h> +#include <asm/div64.h> #define MAX_IO_MSRS 256 #define CR0_RESERVED_BITS \ @@ -917,11 +918,15 @@ static inline int kvm_tsc_changes_freq(void) static inline u64 nsec_to_cycles(u64 nsec) { + u64 ret; + WARN_ON(preemptible()); if (kvm_tsc_changes_freq()) printk_once(KERN_WARNING "kvm: unreliable cycle conversion on adjustable rate TSC\n"); - return (nsec * __get_cpu_var(cpu_tsc_khz)) / USEC_PER_SEC; + ret = nsec * __get_cpu_var(cpu_tsc_khz); + do_div(ret, USEC_PER_SEC); + return ret; } void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) |