aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc/include/asm/atomic_64.h7
-rw-r--r--arch/sparc/include/asm/bitops_64.h5
-rw-r--r--arch/sparc/include/asm/spinlock_64.h14
-rw-r--r--arch/sparc/include/asm/system_64.h35
-rw-r--r--arch/sparc/include/asm/tsb.h6
-rw-r--r--arch/sparc64/kernel/smp.c11
-rw-r--r--arch/sparc64/kernel/trampoline.S4
-rw-r--r--arch/sparc64/kernel/traps.c1
-rw-r--r--arch/sparc64/kernel/tsb.S6
-rw-r--r--arch/sparc64/lib/atomic.S26
-rw-r--r--arch/sparc64/lib/bitops.S24
-rw-r--r--arch/sparc64/lib/rwsem.S7
-rw-r--r--arch/sparc64/mm/init.c2
-rw-r--r--arch/sparc64/mm/tsb.c4
-rw-r--r--arch/sparc64/mm/ultra.S2
15 files changed, 17 insertions, 137 deletions
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 2c71ec4a3b18..5982c5ae7f07 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -112,17 +112,10 @@ static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
112#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 112#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
113 113
114/* Atomic operations are already serializing */ 114/* Atomic operations are already serializing */
115#ifdef CONFIG_SMP
116#define smp_mb__before_atomic_dec() membar_storeload_loadload();
117#define smp_mb__after_atomic_dec() membar_storeload_storestore();
118#define smp_mb__before_atomic_inc() membar_storeload_loadload();
119#define smp_mb__after_atomic_inc() membar_storeload_storestore();
120#else
121#define smp_mb__before_atomic_dec() barrier() 115#define smp_mb__before_atomic_dec() barrier()
122#define smp_mb__after_atomic_dec() barrier() 116#define smp_mb__after_atomic_dec() barrier()
123#define smp_mb__before_atomic_inc() barrier() 117#define smp_mb__before_atomic_inc() barrier()
124#define smp_mb__after_atomic_inc() barrier() 118#define smp_mb__after_atomic_inc() barrier()
125#endif
126 119
127#include <asm-generic/atomic.h> 120#include <asm-generic/atomic.h>
128#endif /* !(__ARCH_SPARC64_ATOMIC__) */ 121#endif /* !(__ARCH_SPARC64_ATOMIC__) */
diff --git a/arch/sparc/include/asm/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index bb87b8080220..e72ac9cdfb98 100644
--- a/arch/sparc/include/asm/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
@@ -23,13 +23,8 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
23 23
24#include <asm-generic/bitops/non-atomic.h> 24#include <asm-generic/bitops/non-atomic.h>
25 25
26#ifdef CONFIG_SMP
27#define smp_mb__before_clear_bit() membar_storeload_loadload()
28#define smp_mb__after_clear_bit() membar_storeload_storestore()
29#else
30#define smp_mb__before_clear_bit() barrier() 26#define smp_mb__before_clear_bit() barrier()
31#define smp_mb__after_clear_bit() barrier() 27#define smp_mb__after_clear_bit() barrier()
32#endif
33 28
34#include <asm-generic/bitops/ffz.h> 29#include <asm-generic/bitops/ffz.h>
35#include <asm-generic/bitops/__ffs.h> 30#include <asm-generic/bitops/__ffs.h>
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index fbac9d00744a..c4d274d330e9 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -33,12 +33,10 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
33 33
34 __asm__ __volatile__( 34 __asm__ __volatile__(
35"1: ldstub [%1], %0\n" 35"1: ldstub [%1], %0\n"
36" membar #StoreLoad | #StoreStore\n"
37" brnz,pn %0, 2f\n" 36" brnz,pn %0, 2f\n"
38" nop\n" 37" nop\n"
39" .subsection 2\n" 38" .subsection 2\n"
40"2: ldub [%1], %0\n" 39"2: ldub [%1], %0\n"
41" membar #LoadLoad\n"
42" brnz,pt %0, 2b\n" 40" brnz,pt %0, 2b\n"
43" nop\n" 41" nop\n"
44" ba,a,pt %%xcc, 1b\n" 42" ba,a,pt %%xcc, 1b\n"
@@ -54,7 +52,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
54 52
55 __asm__ __volatile__( 53 __asm__ __volatile__(
56" ldstub [%1], %0\n" 54" ldstub [%1], %0\n"
57" membar #StoreLoad | #StoreStore"
58 : "=r" (result) 55 : "=r" (result)
59 : "r" (lock) 56 : "r" (lock)
60 : "memory"); 57 : "memory");
@@ -65,7 +62,6 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
65static inline void __raw_spin_unlock(raw_spinlock_t *lock) 62static inline void __raw_spin_unlock(raw_spinlock_t *lock)
66{ 63{
67 __asm__ __volatile__( 64 __asm__ __volatile__(
68" membar #StoreStore | #LoadStore\n"
69" stb %%g0, [%0]" 65" stb %%g0, [%0]"
70 : /* No outputs */ 66 : /* No outputs */
71 : "r" (lock) 67 : "r" (lock)
@@ -78,14 +74,12 @@ static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long fla
78 74
79 __asm__ __volatile__( 75 __asm__ __volatile__(
80"1: ldstub [%2], %0\n" 76"1: ldstub [%2], %0\n"
81" membar #StoreLoad | #StoreStore\n"
82" brnz,pn %0, 2f\n" 77" brnz,pn %0, 2f\n"
83" nop\n" 78" nop\n"
84" .subsection 2\n" 79" .subsection 2\n"
85"2: rdpr %%pil, %1\n" 80"2: rdpr %%pil, %1\n"
86" wrpr %3, %%pil\n" 81" wrpr %3, %%pil\n"
87"3: ldub [%2], %0\n" 82"3: ldub [%2], %0\n"
88" membar #LoadLoad\n"
89" brnz,pt %0, 3b\n" 83" brnz,pt %0, 3b\n"
90" nop\n" 84" nop\n"
91" ba,pt %%xcc, 1b\n" 85" ba,pt %%xcc, 1b\n"
@@ -108,12 +102,10 @@ static void inline __read_lock(raw_rwlock_t *lock)
108"4: add %0, 1, %1\n" 102"4: add %0, 1, %1\n"
109" cas [%2], %0, %1\n" 103" cas [%2], %0, %1\n"
110" cmp %0, %1\n" 104" cmp %0, %1\n"
111" membar #StoreLoad | #StoreStore\n"
112" bne,pn %%icc, 1b\n" 105" bne,pn %%icc, 1b\n"
113" nop\n" 106" nop\n"
114" .subsection 2\n" 107" .subsection 2\n"
115"2: ldsw [%2], %0\n" 108"2: ldsw [%2], %0\n"
116" membar #LoadLoad\n"
117" brlz,pt %0, 2b\n" 109" brlz,pt %0, 2b\n"
118" nop\n" 110" nop\n"
119" ba,a,pt %%xcc, 4b\n" 111" ba,a,pt %%xcc, 4b\n"
@@ -134,7 +126,6 @@ static int inline __read_trylock(raw_rwlock_t *lock)
134" add %0, 1, %1\n" 126" add %0, 1, %1\n"
135" cas [%2], %0, %1\n" 127" cas [%2], %0, %1\n"
136" cmp %0, %1\n" 128" cmp %0, %1\n"
137" membar #StoreLoad | #StoreStore\n"
138" bne,pn %%icc, 1b\n" 129" bne,pn %%icc, 1b\n"
139" mov 1, %0\n" 130" mov 1, %0\n"
140"2:" 131"2:"
@@ -150,7 +141,6 @@ static void inline __read_unlock(raw_rwlock_t *lock)
150 unsigned long tmp1, tmp2; 141 unsigned long tmp1, tmp2;
151 142
152 __asm__ __volatile__( 143 __asm__ __volatile__(
153" membar #StoreLoad | #LoadLoad\n"
154"1: lduw [%2], %0\n" 144"1: lduw [%2], %0\n"
155" sub %0, 1, %1\n" 145" sub %0, 1, %1\n"
156" cas [%2], %0, %1\n" 146" cas [%2], %0, %1\n"
@@ -174,12 +164,10 @@ static void inline __write_lock(raw_rwlock_t *lock)
174"4: or %0, %3, %1\n" 164"4: or %0, %3, %1\n"
175" cas [%2], %0, %1\n" 165" cas [%2], %0, %1\n"
176" cmp %0, %1\n" 166" cmp %0, %1\n"
177" membar #StoreLoad | #StoreStore\n"
178" bne,pn %%icc, 1b\n" 167" bne,pn %%icc, 1b\n"
179" nop\n" 168" nop\n"
180" .subsection 2\n" 169" .subsection 2\n"
181"2: lduw [%2], %0\n" 170"2: lduw [%2], %0\n"
182" membar #LoadLoad\n"
183" brnz,pt %0, 2b\n" 171" brnz,pt %0, 2b\n"
184" nop\n" 172" nop\n"
185" ba,a,pt %%xcc, 4b\n" 173" ba,a,pt %%xcc, 4b\n"
@@ -192,7 +180,6 @@ static void inline __write_lock(raw_rwlock_t *lock)
192static void inline __write_unlock(raw_rwlock_t *lock) 180static void inline __write_unlock(raw_rwlock_t *lock)
193{ 181{
194 __asm__ __volatile__( 182 __asm__ __volatile__(
195" membar #LoadStore | #StoreStore\n"
196" stw %%g0, [%0]" 183" stw %%g0, [%0]"
197 : /* no outputs */ 184 : /* no outputs */
198 : "r" (lock) 185 : "r" (lock)
@@ -212,7 +199,6 @@ static int inline __write_trylock(raw_rwlock_t *lock)
212" or %0, %4, %1\n" 199" or %0, %4, %1\n"
213" cas [%3], %0, %1\n" 200" cas [%3], %0, %1\n"
214" cmp %0, %1\n" 201" cmp %0, %1\n"
215" membar #StoreLoad | #StoreStore\n"
216" bne,pn %%icc, 1b\n" 202" bne,pn %%icc, 1b\n"
217" nop\n" 203" nop\n"
218" mov 1, %2\n" 204" mov 1, %2\n"
diff --git a/arch/sparc/include/asm/system_64.h b/arch/sparc/include/asm/system_64.h
index 8759f2a1b837..7554ad39b5af 100644
--- a/arch/sparc/include/asm/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
@@ -59,20 +59,9 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
59 : : : "memory"); \ 59 : : : "memory"); \
60} while (0) 60} while (0)
61 61
62#define mb() \ 62#define mb() membar_safe("#StoreLoad")
63 membar_safe("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad") 63#define rmb() __asm__ __volatile__("":::"memory")
64#define rmb() \ 64#define wmb() __asm__ __volatile__("":::"memory")
65 membar_safe("#LoadLoad")
66#define wmb() \
67 membar_safe("#StoreStore")
68#define membar_storeload() \
69 membar_safe("#StoreLoad")
70#define membar_storeload_storestore() \
71 membar_safe("#StoreLoad | #StoreStore")
72#define membar_storeload_loadload() \
73 membar_safe("#StoreLoad | #LoadLoad")
74#define membar_storestore_loadstore() \
75 membar_safe("#StoreStore | #LoadStore")
76 65
77#endif 66#endif
78 67
@@ -80,20 +69,20 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
80 69
81#define read_barrier_depends() do { } while(0) 70#define read_barrier_depends() do { } while(0)
82#define set_mb(__var, __value) \ 71#define set_mb(__var, __value) \
83 do { __var = __value; membar_storeload_storestore(); } while(0) 72 do { __var = __value; membar_safe("#StoreLoad"); } while(0)
84 73
85#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
86#define smp_mb() mb() 75#define smp_mb() mb()
87#define smp_rmb() rmb() 76#define smp_rmb() rmb()
88#define smp_wmb() wmb() 77#define smp_wmb() wmb()
89#define smp_read_barrier_depends() read_barrier_depends()
90#else 78#else
91#define smp_mb() __asm__ __volatile__("":::"memory") 79#define smp_mb() __asm__ __volatile__("":::"memory")
92#define smp_rmb() __asm__ __volatile__("":::"memory") 80#define smp_rmb() __asm__ __volatile__("":::"memory")
93#define smp_wmb() __asm__ __volatile__("":::"memory") 81#define smp_wmb() __asm__ __volatile__("":::"memory")
94#define smp_read_barrier_depends() do { } while(0)
95#endif 82#endif
96 83
84#define smp_read_barrier_depends() do { } while(0)
85
97#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory") 86#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
98 87
99#define flushw_all() __asm__ __volatile__("flushw") 88#define flushw_all() __asm__ __volatile__("flushw")
@@ -209,14 +198,12 @@ static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int va
209 unsigned long tmp1, tmp2; 198 unsigned long tmp1, tmp2;
210 199
211 __asm__ __volatile__( 200 __asm__ __volatile__(
212" membar #StoreLoad | #LoadLoad\n"
213" mov %0, %1\n" 201" mov %0, %1\n"
214"1: lduw [%4], %2\n" 202"1: lduw [%4], %2\n"
215" cas [%4], %2, %0\n" 203" cas [%4], %2, %0\n"
216" cmp %2, %0\n" 204" cmp %2, %0\n"
217" bne,a,pn %%icc, 1b\n" 205" bne,a,pn %%icc, 1b\n"
218" mov %1, %0\n" 206" mov %1, %0\n"
219" membar #StoreLoad | #StoreStore\n"
220 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 207 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
221 : "0" (val), "r" (m) 208 : "0" (val), "r" (m)
222 : "cc", "memory"); 209 : "cc", "memory");
@@ -228,14 +215,12 @@ static inline unsigned long xchg64(__volatile__ unsigned long *m, unsigned long
228 unsigned long tmp1, tmp2; 215 unsigned long tmp1, tmp2;
229 216
230 __asm__ __volatile__( 217 __asm__ __volatile__(
231" membar #StoreLoad | #LoadLoad\n"
232" mov %0, %1\n" 218" mov %0, %1\n"
233"1: ldx [%4], %2\n" 219"1: ldx [%4], %2\n"
234" casx [%4], %2, %0\n" 220" casx [%4], %2, %0\n"
235" cmp %2, %0\n" 221" cmp %2, %0\n"
236" bne,a,pn %%xcc, 1b\n" 222" bne,a,pn %%xcc, 1b\n"
237" mov %1, %0\n" 223" mov %1, %0\n"
238" membar #StoreLoad | #StoreStore\n"
239 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2) 224 : "=&r" (val), "=&r" (tmp1), "=&r" (tmp2)
240 : "0" (val), "r" (m) 225 : "0" (val), "r" (m)
241 : "cc", "memory"); 226 : "cc", "memory");
@@ -272,9 +257,7 @@ extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noret
272static inline unsigned long 257static inline unsigned long
273__cmpxchg_u32(volatile int *m, int old, int new) 258__cmpxchg_u32(volatile int *m, int old, int new)
274{ 259{
275 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 260 __asm__ __volatile__("cas [%2], %3, %0"
276 "cas [%2], %3, %0\n\t"
277 "membar #StoreLoad | #StoreStore"
278 : "=&r" (new) 261 : "=&r" (new)
279 : "0" (new), "r" (m), "r" (old) 262 : "0" (new), "r" (m), "r" (old)
280 : "memory"); 263 : "memory");
@@ -285,9 +268,7 @@ __cmpxchg_u32(volatile int *m, int old, int new)
285static inline unsigned long 268static inline unsigned long
286__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new) 269__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
287{ 270{
288 __asm__ __volatile__("membar #StoreLoad | #LoadLoad\n" 271 __asm__ __volatile__("casx [%2], %3, %0"
289 "casx [%2], %3, %0\n\t"
290 "membar #StoreLoad | #StoreStore"
291 : "=&r" (new) 272 : "=&r" (new)
292 : "0" (new), "r" (m), "r" (old) 273 : "0" (new), "r" (m), "r" (old)
293 : "memory"); 274 : "memory");
diff --git a/arch/sparc/include/asm/tsb.h b/arch/sparc/include/asm/tsb.h
index 76e4299dd9bc..83c571d8c8a7 100644
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -50,8 +50,6 @@
50#define TSB_TAG_INVALID_BIT 46 50#define TSB_TAG_INVALID_BIT 46
51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32)) 51#define TSB_TAG_INVALID_HIGH (1 << (TSB_TAG_INVALID_BIT - 32))
52 52
53#define TSB_MEMBAR membar #StoreStore
54
55/* Some cpus support physical address quad loads. We want to use 53/* Some cpus support physical address quad loads. We want to use
56 * those if possible so we don't need to hard-lock the TSB mapping 54 * those if possible so we don't need to hard-lock the TSB mapping
57 * into the TLB. We encode some instruction patching in order to 55 * into the TLB. We encode some instruction patching in order to
@@ -128,13 +126,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
128 cmp REG1, REG2; \ 126 cmp REG1, REG2; \
129 bne,pn %icc, 99b; \ 127 bne,pn %icc, 99b; \
130 nop; \ 128 nop; \
131 TSB_MEMBAR
132 129
133#define TSB_WRITE(TSB, TTE, TAG) \ 130#define TSB_WRITE(TSB, TTE, TAG) \
134 add TSB, 0x8, TSB; \ 131 add TSB, 0x8, TSB; \
135 TSB_STORE(TSB, TTE); \ 132 TSB_STORE(TSB, TTE); \
136 sub TSB, 0x8, TSB; \ 133 sub TSB, 0x8, TSB; \
137 TSB_MEMBAR; \
138 TSB_STORE(TSB, TAG); 134 TSB_STORE(TSB, TAG);
139 135
140#define KTSB_LOAD_QUAD(TSB, REG) \ 136#define KTSB_LOAD_QUAD(TSB, REG) \
@@ -153,13 +149,11 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
153 cmp REG1, REG2; \ 149 cmp REG1, REG2; \
154 bne,pn %icc, 99b; \ 150 bne,pn %icc, 99b; \
155 nop; \ 151 nop; \
156 TSB_MEMBAR
157 152
158#define KTSB_WRITE(TSB, TTE, TAG) \ 153#define KTSB_WRITE(TSB, TTE, TAG) \
159 add TSB, 0x8, TSB; \ 154 add TSB, 0x8, TSB; \
160 stxa TTE, [TSB] ASI_N; \ 155 stxa TTE, [TSB] ASI_N; \
161 sub TSB, 0x8, TSB; \ 156 sub TSB, 0x8, TSB; \
162 TSB_MEMBAR; \
163 stxa TAG, [TSB] ASI_N; 157 stxa TAG, [TSB] ASI_N;
164 158
165 /* Do a kernel page table walk. Leaves physical PTE pointer in 159 /* Do a kernel page table walk. Leaves physical PTE pointer in
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index f500b0618bb0..c6d06362728c 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -163,7 +163,7 @@ static inline long get_delta (long *rt, long *master)
163 for (i = 0; i < NUM_ITERS; i++) { 163 for (i = 0; i < NUM_ITERS; i++) {
164 t0 = tick_ops->get_tick(); 164 t0 = tick_ops->get_tick();
165 go[MASTER] = 1; 165 go[MASTER] = 1;
166 membar_storeload(); 166 membar_safe("#StoreLoad");
167 while (!(tm = go[SLAVE])) 167 while (!(tm = go[SLAVE]))
168 rmb(); 168 rmb();
169 go[SLAVE] = 0; 169 go[SLAVE] = 0;
@@ -257,7 +257,7 @@ static void smp_synchronize_one_tick(int cpu)
257 257
258 /* now let the client proceed into his loop */ 258 /* now let the client proceed into his loop */
259 go[MASTER] = 0; 259 go[MASTER] = 0;
260 membar_storeload(); 260 membar_safe("#StoreLoad");
261 261
262 spin_lock_irqsave(&itc_sync_lock, flags); 262 spin_lock_irqsave(&itc_sync_lock, flags);
263 { 263 {
@@ -267,7 +267,7 @@ static void smp_synchronize_one_tick(int cpu)
267 go[MASTER] = 0; 267 go[MASTER] = 0;
268 wmb(); 268 wmb();
269 go[SLAVE] = tick_ops->get_tick(); 269 go[SLAVE] = tick_ops->get_tick();
270 membar_storeload(); 270 membar_safe("#StoreLoad");
271 } 271 }
272 } 272 }
273 spin_unlock_irqrestore(&itc_sync_lock, flags); 273 spin_unlock_irqrestore(&itc_sync_lock, flags);
@@ -1122,7 +1122,6 @@ void smp_capture(void)
1122 smp_processor_id()); 1122 smp_processor_id());
1123#endif 1123#endif
1124 penguins_are_doing_time = 1; 1124 penguins_are_doing_time = 1;
1125 membar_storestore_loadstore();
1126 atomic_inc(&smp_capture_registry); 1125 atomic_inc(&smp_capture_registry);
1127 smp_cross_call(&xcall_capture, 0, 0, 0); 1126 smp_cross_call(&xcall_capture, 0, 0, 0);
1128 while (atomic_read(&smp_capture_registry) != ncpus) 1127 while (atomic_read(&smp_capture_registry) != ncpus)
@@ -1142,7 +1141,7 @@ void smp_release(void)
1142 smp_processor_id()); 1141 smp_processor_id());
1143#endif 1142#endif
1144 penguins_are_doing_time = 0; 1143 penguins_are_doing_time = 0;
1145 membar_storeload_storestore(); 1144 membar_safe("#StoreLoad");
1146 atomic_dec(&smp_capture_registry); 1145 atomic_dec(&smp_capture_registry);
1147 } 1146 }
1148} 1147}
@@ -1161,7 +1160,7 @@ void smp_penguin_jailcell(int irq, struct pt_regs *regs)
1161 __asm__ __volatile__("flushw"); 1160 __asm__ __volatile__("flushw");
1162 prom_world(1); 1161 prom_world(1);
1163 atomic_inc(&smp_capture_registry); 1162 atomic_inc(&smp_capture_registry);
1164 membar_storeload_storestore(); 1163 membar_safe("#StoreLoad");
1165 while (penguins_are_doing_time) 1164 while (penguins_are_doing_time)
1166 rmb(); 1165 rmb();
1167 atomic_dec(&smp_capture_registry); 1166 atomic_dec(&smp_capture_registry);
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 83abd5ae88a4..da1b781b5e65 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -109,7 +109,6 @@ startup_continue:
109 */ 109 */
110 sethi %hi(prom_entry_lock), %g2 110 sethi %hi(prom_entry_lock), %g2
1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1 1111: ldstub [%g2 + %lo(prom_entry_lock)], %g1
112 membar #StoreLoad | #StoreStore
113 brnz,pn %g1, 1b 112 brnz,pn %g1, 1b
114 nop 113 nop
115 114
@@ -214,7 +213,6 @@ startup_continue:
214 213
215 sethi %hi(prom_entry_lock), %g2 214 sethi %hi(prom_entry_lock), %g2
216 stb %g0, [%g2 + %lo(prom_entry_lock)] 215 stb %g0, [%g2 + %lo(prom_entry_lock)]
217 membar #StoreStore | #StoreLoad
218 216
219 ba,pt %xcc, after_lock_tlb 217 ba,pt %xcc, after_lock_tlb
220 nop 218 nop
@@ -330,7 +328,6 @@ after_lock_tlb:
330 328
331 sethi %hi(prom_entry_lock), %g2 329 sethi %hi(prom_entry_lock), %g2
3321: ldstub [%g2 + %lo(prom_entry_lock)], %g1 3301: ldstub [%g2 + %lo(prom_entry_lock)], %g1
333 membar #StoreLoad | #StoreStore
334 brnz,pn %g1, 1b 331 brnz,pn %g1, 1b
335 nop 332 nop
336 333
@@ -394,7 +391,6 @@ after_lock_tlb:
394 391
3953: sethi %hi(prom_entry_lock), %g2 3923: sethi %hi(prom_entry_lock), %g2
396 stb %g0, [%g2 + %lo(prom_entry_lock)] 393 stb %g0, [%g2 + %lo(prom_entry_lock)]
397 membar #StoreStore | #StoreLoad
398 394
399 ldx [%l0], %g6 395 ldx [%l0], %g6
400 ldx [%g6 + TI_TASK], %g4 396 ldx [%g6 + TI_TASK], %g4
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 81ccd22e78d4..04994fc8700d 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1371,7 +1371,6 @@ static int cheetah_fix_ce(unsigned long physaddr)
1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t" 1371 __asm__ __volatile__("ldxa [%0] %3, %%g0\n\t"
1372 "ldxa [%1] %3, %%g0\n\t" 1372 "ldxa [%1] %3, %%g0\n\t"
1373 "casxa [%2] %3, %%g0, %%g0\n\t" 1373 "casxa [%2] %3, %%g0, %%g0\n\t"
1374 "membar #StoreLoad | #StoreStore\n\t"
1375 "ldxa [%0] %3, %%g0\n\t" 1374 "ldxa [%0] %3, %%g0\n\t"
1376 "ldxa [%1] %3, %%g0\n\t" 1375 "ldxa [%1] %3, %%g0\n\t"
1377 "membar #Sync" 1376 "membar #Sync"
diff --git a/arch/sparc64/kernel/tsb.S b/arch/sparc64/kernel/tsb.S
index c499214b501d..8c91d9b29a2f 100644
--- a/arch/sparc64/kernel/tsb.S
+++ b/arch/sparc64/kernel/tsb.S
@@ -317,7 +317,7 @@ tsb_flush:
317 srlx %g1, 32, %o3 317 srlx %g1, 32, %o3
318 andcc %o3, %g2, %g0 318 andcc %o3, %g2, %g0
319 bne,pn %icc, 1b 319 bne,pn %icc, 1b
320 membar #LoadLoad 320 nop
321 cmp %g1, %o1 321 cmp %g1, %o1
322 mov 1, %o3 322 mov 1, %o3
323 bne,pt %xcc, 2f 323 bne,pt %xcc, 2f
@@ -327,7 +327,7 @@ tsb_flush:
327 bne,pn %xcc, 1b 327 bne,pn %xcc, 1b
328 nop 328 nop
3292: retl 3292: retl
330 TSB_MEMBAR 330 nop
331 .size tsb_flush, .-tsb_flush 331 .size tsb_flush, .-tsb_flush
332 332
333 /* Reload MMU related context switch state at 333 /* Reload MMU related context switch state at
@@ -478,7 +478,7 @@ copy_tsb: /* %o0=old_tsb_base, %o1=old_tsb_size
478 nop 478 nop
479 479
480 retl 480 retl
481 TSB_MEMBAR 481 nop
482 .size copy_tsb, .-copy_tsb 482 .size copy_tsb, .-copy_tsb
483 483
484 /* Set the invalid bit in all TSB entries. */ 484 /* Set the invalid bit in all TSB entries. */
diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc64/lib/atomic.S
index 70ac4186f62b..0268210ca168 100644
--- a/arch/sparc64/lib/atomic.S
+++ b/arch/sparc64/lib/atomic.S
@@ -43,29 +43,10 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
432: BACKOFF_SPIN(%o2, %o3, 1b) 432: BACKOFF_SPIN(%o2, %o3, 1b)
44 .size atomic_sub, .-atomic_sub 44 .size atomic_sub, .-atomic_sub
45 45
46 /* On SMP we need to use memory barriers to ensure
47 * correct memory operation ordering, nop these out
48 * for uniprocessor.
49 */
50#ifdef CONFIG_SMP
51
52#define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad;
53#define ATOMIC_POST_BARRIER \
54 ba,pt %xcc, 80b; \
55 membar #StoreLoad | #StoreStore
56
5780: retl
58 nop
59#else
60#define ATOMIC_PRE_BARRIER
61#define ATOMIC_POST_BARRIER
62#endif
63
64 .globl atomic_add_ret 46 .globl atomic_add_ret
65 .type atomic_add_ret,#function 47 .type atomic_add_ret,#function
66atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 48atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
67 BACKOFF_SETUP(%o2) 49 BACKOFF_SETUP(%o2)
68 ATOMIC_PRE_BARRIER
691: lduw [%o1], %g1 501: lduw [%o1], %g1
70 add %g1, %o0, %g7 51 add %g1, %o0, %g7
71 cas [%o1], %g1, %g7 52 cas [%o1], %g1, %g7
@@ -73,7 +54,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
73 bne,pn %icc, 2f 54 bne,pn %icc, 2f
74 add %g7, %o0, %g7 55 add %g7, %o0, %g7
75 sra %g7, 0, %o0 56 sra %g7, 0, %o0
76 ATOMIC_POST_BARRIER
77 retl 57 retl
78 nop 58 nop
792: BACKOFF_SPIN(%o2, %o3, 1b) 592: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -83,7 +63,6 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
83 .type atomic_sub_ret,#function 63 .type atomic_sub_ret,#function
84atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 64atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
85 BACKOFF_SETUP(%o2) 65 BACKOFF_SETUP(%o2)
86 ATOMIC_PRE_BARRIER
871: lduw [%o1], %g1 661: lduw [%o1], %g1
88 sub %g1, %o0, %g7 67 sub %g1, %o0, %g7
89 cas [%o1], %g1, %g7 68 cas [%o1], %g1, %g7
@@ -91,7 +70,6 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
91 bne,pn %icc, 2f 70 bne,pn %icc, 2f
92 sub %g7, %o0, %g7 71 sub %g7, %o0, %g7
93 sra %g7, 0, %o0 72 sra %g7, 0, %o0
94 ATOMIC_POST_BARRIER
95 retl 73 retl
96 nop 74 nop
972: BACKOFF_SPIN(%o2, %o3, 1b) 752: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -131,7 +109,6 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
131 .type atomic64_add_ret,#function 109 .type atomic64_add_ret,#function
132atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 110atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
133 BACKOFF_SETUP(%o2) 111 BACKOFF_SETUP(%o2)
134 ATOMIC_PRE_BARRIER
1351: ldx [%o1], %g1 1121: ldx [%o1], %g1
136 add %g1, %o0, %g7 113 add %g1, %o0, %g7
137 casx [%o1], %g1, %g7 114 casx [%o1], %g1, %g7
@@ -139,7 +116,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
139 bne,pn %xcc, 2f 116 bne,pn %xcc, 2f
140 add %g7, %o0, %g7 117 add %g7, %o0, %g7
141 mov %g7, %o0 118 mov %g7, %o0
142 ATOMIC_POST_BARRIER
143 retl 119 retl
144 nop 120 nop
1452: BACKOFF_SPIN(%o2, %o3, 1b) 1212: BACKOFF_SPIN(%o2, %o3, 1b)
@@ -149,7 +125,6 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
149 .type atomic64_sub_ret,#function 125 .type atomic64_sub_ret,#function
150atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 126atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
151 BACKOFF_SETUP(%o2) 127 BACKOFF_SETUP(%o2)
152 ATOMIC_PRE_BARRIER
1531: ldx [%o1], %g1 1281: ldx [%o1], %g1
154 sub %g1, %o0, %g7 129 sub %g1, %o0, %g7
155 casx [%o1], %g1, %g7 130 casx [%o1], %g1, %g7
@@ -157,7 +132,6 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
157 bne,pn %xcc, 2f 132 bne,pn %xcc, 2f
158 sub %g7, %o0, %g7 133 sub %g7, %o0, %g7
159 mov %g7, %o0 134 mov %g7, %o0
160 ATOMIC_POST_BARRIER
161 retl 135 retl
162 nop 136 nop
1632: BACKOFF_SPIN(%o2, %o3, 1b) 1372: BACKOFF_SPIN(%o2, %o3, 1b)
diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc64/lib/bitops.S
index 6b015a6eefb5..2b7228cb8c22 100644
--- a/arch/sparc64/lib/bitops.S
+++ b/arch/sparc64/lib/bitops.S
@@ -8,29 +8,10 @@
8 8
9 .text 9 .text
10 10
11 /* On SMP we need to use memory barriers to ensure
12 * correct memory operation ordering, nop these out
13 * for uniprocessor.
14 */
15
16#ifdef CONFIG_SMP
17#define BITOP_PRE_BARRIER membar #StoreLoad | #LoadLoad
18#define BITOP_POST_BARRIER \
19 ba,pt %xcc, 80b; \
20 membar #StoreLoad | #StoreStore
21
2280: retl
23 nop
24#else
25#define BITOP_PRE_BARRIER
26#define BITOP_POST_BARRIER
27#endif
28
29 .globl test_and_set_bit 11 .globl test_and_set_bit
30 .type test_and_set_bit,#function 12 .type test_and_set_bit,#function
31test_and_set_bit: /* %o0=nr, %o1=addr */ 13test_and_set_bit: /* %o0=nr, %o1=addr */
32 BACKOFF_SETUP(%o3) 14 BACKOFF_SETUP(%o3)
33 BITOP_PRE_BARRIER
34 srlx %o0, 6, %g1 15 srlx %o0, 6, %g1
35 mov 1, %o2 16 mov 1, %o2
36 sllx %g1, 3, %g3 17 sllx %g1, 3, %g3
@@ -45,7 +26,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
45 and %g7, %o2, %g2 26 and %g7, %o2, %g2
46 clr %o0 27 clr %o0
47 movrne %g2, 1, %o0 28 movrne %g2, 1, %o0
48 BITOP_POST_BARRIER
49 retl 29 retl
50 nop 30 nop
512: BACKOFF_SPIN(%o3, %o4, 1b) 312: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -55,7 +35,6 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
55 .type test_and_clear_bit,#function 35 .type test_and_clear_bit,#function
56test_and_clear_bit: /* %o0=nr, %o1=addr */ 36test_and_clear_bit: /* %o0=nr, %o1=addr */
57 BACKOFF_SETUP(%o3) 37 BACKOFF_SETUP(%o3)
58 BITOP_PRE_BARRIER
59 srlx %o0, 6, %g1 38 srlx %o0, 6, %g1
60 mov 1, %o2 39 mov 1, %o2
61 sllx %g1, 3, %g3 40 sllx %g1, 3, %g3
@@ -70,7 +49,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
70 and %g7, %o2, %g2 49 and %g7, %o2, %g2
71 clr %o0 50 clr %o0
72 movrne %g2, 1, %o0 51 movrne %g2, 1, %o0
73 BITOP_POST_BARRIER
74 retl 52 retl
75 nop 53 nop
762: BACKOFF_SPIN(%o3, %o4, 1b) 542: BACKOFF_SPIN(%o3, %o4, 1b)
@@ -80,7 +58,6 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
80 .type test_and_change_bit,#function 58 .type test_and_change_bit,#function
81test_and_change_bit: /* %o0=nr, %o1=addr */ 59test_and_change_bit: /* %o0=nr, %o1=addr */
82 BACKOFF_SETUP(%o3) 60 BACKOFF_SETUP(%o3)
83 BITOP_PRE_BARRIER
84 srlx %o0, 6, %g1 61 srlx %o0, 6, %g1
85 mov 1, %o2 62 mov 1, %o2
86 sllx %g1, 3, %g3 63 sllx %g1, 3, %g3
@@ -95,7 +72,6 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
95 and %g7, %o2, %g2 72 and %g7, %o2, %g2
96 clr %o0 73 clr %o0
97 movrne %g2, 1, %o0 74 movrne %g2, 1, %o0
98 BITOP_POST_BARRIER
99 retl 75 retl
100 nop 76 nop
1012: BACKOFF_SPIN(%o3, %o4, 1b) 772: BACKOFF_SPIN(%o3, %o4, 1b)
diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc64/lib/rwsem.S
index 1a4cc5654de4..91a7d29a79d5 100644
--- a/arch/sparc64/lib/rwsem.S
+++ b/arch/sparc64/lib/rwsem.S
@@ -17,7 +17,6 @@ __down_read:
17 bne,pn %icc, 1b 17 bne,pn %icc, 1b
18 add %g7, 1, %g7 18 add %g7, 1, %g7
19 cmp %g7, 0 19 cmp %g7, 0
20 membar #StoreLoad | #StoreStore
21 bl,pn %icc, 3f 20 bl,pn %icc, 3f
22 nop 21 nop
232: 222:
@@ -42,7 +41,6 @@ __down_read_trylock:
42 cmp %g1, %g7 41 cmp %g1, %g7
43 bne,pn %icc, 1b 42 bne,pn %icc, 1b
44 mov 1, %o1 43 mov 1, %o1
45 membar #StoreLoad | #StoreStore
462: retl 442: retl
47 mov %o1, %o0 45 mov %o1, %o0
48 .size __down_read_trylock, .-__down_read_trylock 46 .size __down_read_trylock, .-__down_read_trylock
@@ -58,7 +56,6 @@ __down_write:
58 cmp %g3, %g7 56 cmp %g3, %g7
59 bne,pn %icc, 1b 57 bne,pn %icc, 1b
60 cmp %g7, 0 58 cmp %g7, 0
61 membar #StoreLoad | #StoreStore
62 bne,pn %icc, 3f 59 bne,pn %icc, 3f
63 nop 60 nop
642: retl 612: retl
@@ -85,7 +82,6 @@ __down_write_trylock:
85 cmp %g3, %g7 82 cmp %g3, %g7
86 bne,pn %icc, 1b 83 bne,pn %icc, 1b
87 mov 1, %o1 84 mov 1, %o1
88 membar #StoreLoad | #StoreStore
892: retl 852: retl
90 mov %o1, %o0 86 mov %o1, %o0
91 .size __down_write_trylock, .-__down_write_trylock 87 .size __down_write_trylock, .-__down_write_trylock
@@ -99,7 +95,6 @@ __up_read:
99 cmp %g1, %g7 95 cmp %g1, %g7
100 bne,pn %icc, 1b 96 bne,pn %icc, 1b
101 cmp %g7, 0 97 cmp %g7, 0
102 membar #StoreLoad | #StoreStore
103 bl,pn %icc, 3f 98 bl,pn %icc, 3f
104 nop 99 nop
1052: retl 1002: retl
@@ -129,7 +124,6 @@ __up_write:
129 bne,pn %icc, 1b 124 bne,pn %icc, 1b
130 sub %g7, %g1, %g7 125 sub %g7, %g1, %g7
131 cmp %g7, 0 126 cmp %g7, 0
132 membar #StoreLoad | #StoreStore
133 bl,pn %icc, 3f 127 bl,pn %icc, 3f
134 nop 128 nop
1352: 1292:
@@ -155,7 +149,6 @@ __downgrade_write:
155 bne,pn %icc, 1b 149 bne,pn %icc, 1b
156 sub %g7, %g1, %g7 150 sub %g7, %g1, %g7
157 cmp %g7, 0 151 cmp %g7, 0
158 membar #StoreLoad | #StoreStore
159 bl,pn %icc, 3f 152 bl,pn %icc, 3f
160 nop 153 nop
1612: 1542:
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 185f34679110..4bd63968400d 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -214,7 +214,6 @@ static inline void set_dcache_dirty(struct page *page, int this_cpu)
214 "or %%g1, %0, %%g1\n\t" 214 "or %%g1, %0, %%g1\n\t"
215 "casx [%2], %%g7, %%g1\n\t" 215 "casx [%2], %%g7, %%g1\n\t"
216 "cmp %%g7, %%g1\n\t" 216 "cmp %%g7, %%g1\n\t"
217 "membar #StoreLoad | #StoreStore\n\t"
218 "bne,pn %%xcc, 1b\n\t" 217 "bne,pn %%xcc, 1b\n\t"
219 " nop" 218 " nop"
220 : /* no outputs */ 219 : /* no outputs */
@@ -236,7 +235,6 @@ static inline void clear_dcache_dirty_cpu(struct page *page, unsigned long cpu)
236 " andn %%g7, %1, %%g1\n\t" 235 " andn %%g7, %1, %%g1\n\t"
237 "casx [%2], %%g7, %%g1\n\t" 236 "casx [%2], %%g7, %%g1\n\t"
238 "cmp %%g7, %%g1\n\t" 237 "cmp %%g7, %%g1\n\t"
239 "membar #StoreLoad | #StoreStore\n\t"
240 "bne,pn %%xcc, 1b\n\t" 238 "bne,pn %%xcc, 1b\n\t"
241 " nop\n" 239 " nop\n"
242 "2:" 240 "2:"
diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc64/mm/tsb.c
index 587f8efb2e05..f0282fad632a 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc64/mm/tsb.c
@@ -41,10 +41,8 @@ void flush_tsb_kernel_range(unsigned long start, unsigned long end)
41 KERNEL_TSB_NENTRIES); 41 KERNEL_TSB_NENTRIES);
42 struct tsb *ent = &swapper_tsb[hash]; 42 struct tsb *ent = &swapper_tsb[hash];
43 43
44 if (tag_compare(ent->tag, v)) { 44 if (tag_compare(ent->tag, v))
45 ent->tag = (1UL << TSB_TAG_INVALID_BIT); 45 ent->tag = (1UL << TSB_TAG_INVALID_BIT);
46 membar_storeload_storestore();
47 }
48 } 46 }
49} 47}
50 48
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 86773e89dc1b..e4c146f7c7e9 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -125,7 +125,6 @@ __spitfire_flush_tlb_mm_slow:
125 .align 32 125 .align 32
126 .globl __flush_icache_page 126 .globl __flush_icache_page
127__flush_icache_page: /* %o0 = phys_page */ 127__flush_icache_page: /* %o0 = phys_page */
128 membar #StoreStore
129 srlx %o0, PAGE_SHIFT, %o0 128 srlx %o0, PAGE_SHIFT, %o0
130 sethi %uhi(PAGE_OFFSET), %g1 129 sethi %uhi(PAGE_OFFSET), %g1
131 sllx %o0, PAGE_SHIFT, %o0 130 sllx %o0, PAGE_SHIFT, %o0
@@ -507,7 +506,6 @@ xcall_fetch_glob_regs:
507 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2 506 sllx %g2, TRAP_BLOCK_SZ_SHIFT, %g2
508 add %g7, %g2, %g7 507 add %g7, %g2, %g7
509 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3 508 ldx [%g7 + TRAP_PER_CPU_THREAD], %g3
510 membar #StoreStore
511 stx %g3, [%g1 + GR_SNAP_THREAD] 509 stx %g3, [%g1 + GR_SNAP_THREAD]
512 retry 510 retry
513 511