diff mbox

kvm/lapic.c: fix "__moddi3 undefined" build failure

Message ID 1232934916-19565-1-git-send-email-cnoss@gmx.de (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Clemens Noss Jan. 26, 2009, 1:55 a.m. UTC
use mod_64 from arch/x86/kvm/i8254.c to fix
ERROR: "__moddi3" [arch/x86/kvm/kvm.ko] undefined!

Signed-off-by: Clemens Noss <cnoss@gmx.de>
---

Patch against kvm/master branch, to fix the build failure reported by
Randy Dunlap on lkml.

My virtual machine still works.

---
 arch/x86/kvm/lapic.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Comments

Marcelo Tosatti Jan. 26, 2009, 2:56 p.m. UTC | #1
On Mon, Jan 26, 2009 at 02:55:16AM +0100, Clemens Noss wrote:
> use mod_64 from arch/x86/kvm/i8254.c to fix
> ERROR: "__moddi3" [arch/x86/kvm/kvm.ko] undefined!
> 
> Signed-off-by: Clemens Noss <cnoss@gmx.de>
> ---
> 
> Patch against kvm/master branch, to fix the build failure reported by
> Randy Dunlap on lkml.
> 
> My virtual machine still works.

Applied, thanks.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index d8adc50..f0b67f2 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -35,6 +35,12 @@ 
 #include "kvm_cache_regs.h"
 #include "irq.h"
 
+#ifndef CONFIG_X86_64
+#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
+#else
+#define mod_64(x, y) ((x) % (y))
+#endif
+
 #define PRId64 "d"
 #define PRIx64 "llx"
 #define PRIu64 "u"
@@ -525,7 +531,7 @@  static u32 apic_get_tmcct(struct kvm_lapic *apic)
 	if (ktime_to_ns(remaining) < 0)
 		remaining = ktime_set(0, 0);
 
-	ns = ktime_to_ns(remaining) % apic->timer.period;
+	ns = mod_64(ktime_to_ns(remaining), apic->timer.period);
 	tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
 
 	return tmcct;