diff options
| author | Paul Mackerras <paulus@samba.org> | 2005-10-22 00:55:23 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2005-10-22 00:55:23 -0400 |
| commit | a5b518ed314bfd25ea5e433ce09f8b27080023db (patch) | |
| tree | 777d0f9202136dcff484121ad7673eb65d099567 | |
| parent | e2b5530698cbe8148577b24097eaefcd835ac9ca (diff) | |
ppc64/powerpc: Fix time initialization on SMP systems
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>
| -rw-r--r-- | arch/powerpc/kernel/time.c | 14 | ||||
| -rw-r--r-- | arch/ppc64/kernel/smp.c | 15 | ||||
| -rw-r--r-- | include/asm-powerpc/time.h | 8 |
3 files changed, 6 insertions, 31 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 3e722370113b..b635c7de6698 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
| @@ -458,7 +458,7 @@ void wakeup_decrementer(void) | |||
| 458 | per_cpu(last_jiffy, i) = tb_last_stamp; | 458 | per_cpu(last_jiffy, i) = tb_last_stamp; |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | #ifdef CONFIG_SMPxxx | 461 | #ifdef CONFIG_SMP |
| 462 | void __init smp_space_timers(unsigned int max_cpus) | 462 | void __init smp_space_timers(unsigned int max_cpus) |
| 463 | { | 463 | { |
| 464 | int i; | 464 | int i; |
| @@ -948,16 +948,6 @@ void div128_by_32(u64 dividend_high, u64 dividend_low, | |||
| 948 | w = a / divisor; | 948 | w = a / divisor; |
| 949 | ra = ((u64)(a - (w * divisor)) << 32) + b; | 949 | ra = ((u64)(a - (w * divisor)) << 32) + b; |
| 950 | 950 | ||
| 951 | #ifdef CONFIG_PPC64 | ||
| 952 | x = ra / divisor; | ||
| 953 | rb = ((ra - (x * divisor)) << 32) + c; | ||
| 954 | |||
| 955 | y = rb / divisor; | ||
| 956 | rc = ((rb - (y * divisor)) << 32) + d; | ||
| 957 | |||
| 958 | z = rc / divisor; | ||
| 959 | #else | ||
| 960 | /* for 32-bit, use do_div from div64.h */ | ||
| 961 | rb = ((u64) do_div(ra, divisor) << 32) + c; | 951 | rb = ((u64) do_div(ra, divisor) << 32) + c; |
| 962 | x = ra; | 952 | x = ra; |
| 963 | 953 | ||
| @@ -966,10 +956,8 @@ void div128_by_32(u64 dividend_high, u64 dividend_low, | |||
| 966 | 956 | ||
| 967 | do_div(rc, divisor); | 957 | do_div(rc, divisor); |
| 968 | z = rc; | 958 | z = rc; |
| 969 | #endif | ||
| 970 | 959 | ||
| 971 | dr->result_high = ((u64)w << 32) + x; | 960 | dr->result_high = ((u64)w << 32) + x; |
| 972 | dr->result_low = ((u64)y << 32) + z; | 961 | dr->result_low = ((u64)y << 32) + z; |
| 973 | 962 | ||
| 974 | } | 963 | } |
| 975 | |||
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c index 192e3239fadc..017c12919832 100644 --- a/arch/ppc64/kernel/smp.c +++ b/arch/ppc64/kernel/smp.c | |||
| @@ -105,21 +105,6 @@ void __devinit smp_generic_kick_cpu(int nr) | |||
| 105 | 105 | ||
| 106 | #endif /* CONFIG_MPIC */ | 106 | #endif /* CONFIG_MPIC */ |
| 107 | 107 | ||
| 108 | static void __init smp_space_timers(unsigned int max_cpus) | ||
| 109 | { | ||
| 110 | int i; | ||
| 111 | unsigned long offset = tb_ticks_per_jiffy / max_cpus; | ||
| 112 | unsigned long previous_tb = paca[boot_cpuid].next_jiffy_update_tb; | ||
| 113 | |||
| 114 | for_each_cpu(i) { | ||
| 115 | if (i != boot_cpuid) { | ||
| 116 | paca[i].next_jiffy_update_tb = | ||
| 117 | previous_tb + offset; | ||
| 118 | previous_tb = paca[i].next_jiffy_update_tb; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | void smp_message_recv(int msg, struct pt_regs *regs) | 108 | void smp_message_recv(int msg, struct pt_regs *regs) |
| 124 | { | 109 | { |
| 125 | switch(msg) { | 110 | switch(msg) { |
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index f8ef186c81e4..99bfe3281768 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h | |||
| @@ -196,9 +196,11 @@ static inline unsigned long tb_ticks_since(unsigned long tstamp) | |||
| 196 | extern u64 mulhdu(u64, u64); | 196 | extern u64 mulhdu(u64, u64); |
| 197 | #endif | 197 | #endif |
| 198 | 198 | ||
| 199 | unsigned mulhwu_scale_factor(unsigned, unsigned); | 199 | extern void smp_space_timers(unsigned int); |
| 200 | void div128_by_32(u64 dividend_high, u64 dividend_low, | 200 | |
| 201 | unsigned divisor, struct div_result *dr); | 201 | extern unsigned mulhwu_scale_factor(unsigned, unsigned); |
| 202 | extern void div128_by_32(u64 dividend_high, u64 dividend_low, | ||
| 203 | unsigned divisor, struct div_result *dr); | ||
| 202 | 204 | ||
| 203 | /* Used to store Processor Utilization register (purr) values */ | 205 | /* Used to store Processor Utilization register (purr) values */ |
| 204 | 206 | ||
