aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-08-26 06:38:03 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:51:43 -0400
commit217fc9cfca21a0bc2f4246183ebd8ee9863b019d (patch)
tree905be9d9db39e189ecf7221d520646cf18b7b4b4 /arch/x86
parent34d1f4905eb66478a890ea808ec58bc842e6e589 (diff)
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>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/x86.c7
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
918static inline u64 nsec_to_cycles(u64 nsec) 919static 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
927void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data) 932void kvm_write_tsc(struct kvm_vcpu *vcpu, u64 data)