Commit 217fc9cf authored by Avi Kivity's avatar Avi Kivity

KVM: Fix build error due to 64-bit division in nsec_to_cycles()

Use do_div() instead.
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 34d1f490
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <asm/i387.h> #include <asm/i387.h>
#include <asm/xcr.h> #include <asm/xcr.h>
#include <asm/pvclock.h> #include <asm/pvclock.h>
#include <asm/div64.h>
#define MAX_IO_MSRS 256 #define MAX_IO_MSRS 256
#define CR0_RESERVED_BITS \ #define CR0_RESERVED_BITS \
...@@ -917,11 +918,15 @@ static inline int kvm_tsc_changes_freq(void) ...@@ -917,11 +918,15 @@ static inline int kvm_tsc_changes_freq(void)
static inline u64 nsec_to_cycles(u64 nsec) static inline u64 nsec_to_cycles(u64 nsec)
{ {
u64 ret;
WARN_ON(preemptible()); WARN_ON(preemptible());
if (kvm_tsc_changes_freq()) if (kvm_tsc_changes_freq())
printk_once(KERN_WARNING printk_once(KERN_WARNING
"kvm: unreliable cycle conversion on adjustable rate TSC\n"); "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) void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)
......
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