use mod_64 from arch/x86/kvm/i8254.c to fix
ERROR: "__moddi3" [arch/x86/kvm/kvm.ko] undefined!

Signed-off-by: Clemens Noss <cn...@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(-)

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;
-- 
1.6.1

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

Reply via email to