ppc64/powerpc: Fix time initialization on SMP systems
authorPaul Mackerras <paulus@samba.org>
Sat, 22 Oct 2005 04:55:23 +0000 (14:55 +1000)
committerPaul Mackerras <paulus@samba.org>
Sat, 22 Oct 2005 04:55:23 +0000 (14:55 +1000)
This moves smp_space_timers from arch/ppc64/kernel/smp.c to
arch/powerpc/kernel/time.c and makes it initialize last_jiffy[]
instead of paca[].next_jiffy_update_tb, since last_jiffy[] is
now what the time code uses.  It also declares smp_space_timers
in include/asm-powerpc/time.h and gets rid of an ifdef in
div128_by_32.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/time.c
arch/ppc64/kernel/smp.c
include/asm-powerpc/time.h

index 3e722370113b793ed841de5b095a9fbbf0dc265f..b635c7de66982ba51a433aaddc3fffa5908de2f5 100644 (file)
@@ -458,7 +458,7 @@ void wakeup_decrementer(void)
                per_cpu(last_jiffy, i) = tb_last_stamp;
 }
 
-#ifdef CONFIG_SMPxxx
+#ifdef CONFIG_SMP
 void __init smp_space_timers(unsigned int max_cpus)
 {
        int i;
@@ -948,16 +948,6 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
        w = a / divisor;
        ra = ((u64)(a - (w * divisor)) << 32) + b;
 
-#ifdef CONFIG_PPC64
-       x = ra / divisor;
-       rb = ((ra - (x * divisor)) << 32) + c;
-
-       y = rb / divisor;
-       rc = ((rb - (y * divisor)) << 32) + d;
-
-       z = rc / divisor;
-#else
-       /* for 32-bit, use do_div from div64.h */
        rb = ((u64) do_div(ra, divisor) << 32) + c;
        x = ra;
 
@@ -966,10 +956,8 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
 
        do_div(rc, divisor);
        z = rc;
-#endif
 
        dr->result_high = ((u64)w << 32) + x;
        dr->result_low  = ((u64)y << 32) + z;
 
 }
-
index 192e3239fadcda352c84e9ffe2a2b698d1f00546..017c12919832c01350ed5d6d2f3ea2064fc0445a 100644 (file)
@@ -105,21 +105,6 @@ void __devinit smp_generic_kick_cpu(int nr)
 
 #endif /* CONFIG_MPIC */
 
-static void __init smp_space_timers(unsigned int max_cpus)
-{
-       int i;
-       unsigned long offset = tb_ticks_per_jiffy / max_cpus;
-       unsigned long previous_tb = paca[boot_cpuid].next_jiffy_update_tb;
-
-       for_each_cpu(i) {
-               if (i != boot_cpuid) {
-                       paca[i].next_jiffy_update_tb =
-                               previous_tb + offset;
-                       previous_tb = paca[i].next_jiffy_update_tb;
-               }
-       }
-}
-
 void smp_message_recv(int msg, struct pt_regs *regs)
 {
        switch(msg) {
index f8ef186c81e4764482f5d93c436d8b0cbce3b3f7..99bfe32817682a9cef8c27318c652585a9aad7f6 100644 (file)
@@ -196,9 +196,11 @@ static inline unsigned long tb_ticks_since(unsigned long tstamp)
 extern u64 mulhdu(u64, u64);
 #endif
 
-unsigned mulhwu_scale_factor(unsigned, unsigned);
-void div128_by_32(u64 dividend_high, u64 dividend_low,
-                 unsigned divisor, struct div_result *dr);
+extern void smp_space_timers(unsigned int);
+
+extern unsigned mulhwu_scale_factor(unsigned, unsigned);
+extern void div128_by_32(u64 dividend_high, u64 dividend_low,
+                        unsigned divisor, struct div_result *dr);
 
 /* Used to store Processor Utilization register (purr) values */