|
17 | 17 | #include <asm/pgtable-64.h>
|
18 | 18 | #endif
|
19 | 19 |
|
| 20 | +#include <asm/cmpxchg.h> |
20 | 21 | #include <asm/io.h>
|
21 | 22 | #include <asm/pgtable-bits.h>
|
22 | 23 |
|
@@ -204,49 +205,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
|
204 | 205 | * Make sure the buddy is global too (if it's !none,
|
205 | 206 | * it better already be global)
|
206 | 207 | */
|
207 |
| -#ifdef CONFIG_SMP |
208 |
| - /* |
209 |
| - * For SMP, multiple CPUs can race, so we need to do |
210 |
| - * this atomically. |
211 |
| - */ |
212 |
| - unsigned long page_global = _PAGE_GLOBAL; |
213 |
| - unsigned long tmp; |
214 |
| - |
215 |
| - if (kernel_uses_llsc && R10000_LLSC_WAR) { |
216 |
| - __asm__ __volatile__ ( |
217 |
| - " .set push \n" |
218 |
| - " .set arch=r4000 \n" |
219 |
| - " .set noreorder \n" |
220 |
| - "1:" __LL "%[tmp], %[buddy] \n" |
221 |
| - " bnez %[tmp], 2f \n" |
222 |
| - " or %[tmp], %[tmp], %[global] \n" |
223 |
| - __SC "%[tmp], %[buddy] \n" |
224 |
| - " beqzl %[tmp], 1b \n" |
225 |
| - " nop \n" |
226 |
| - "2: \n" |
227 |
| - " .set pop \n" |
228 |
| - : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
229 |
| - : [global] "r" (page_global)); |
230 |
| - } else if (kernel_uses_llsc) { |
231 |
| - __asm__ __volatile__ ( |
232 |
| - " .set push \n" |
233 |
| - " .set "MIPS_ISA_ARCH_LEVEL" \n" |
234 |
| - " .set noreorder \n" |
235 |
| - "1:" __LL "%[tmp], %[buddy] \n" |
236 |
| - " bnez %[tmp], 2f \n" |
237 |
| - " or %[tmp], %[tmp], %[global] \n" |
238 |
| - __SC "%[tmp], %[buddy] \n" |
239 |
| - " beqz %[tmp], 1b \n" |
240 |
| - " nop \n" |
241 |
| - "2: \n" |
242 |
| - " .set pop \n" |
243 |
| - : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
244 |
| - : [global] "r" (page_global)); |
245 |
| - } |
246 |
| -#else /* !CONFIG_SMP */ |
247 |
| - if (pte_none(*buddy)) |
248 |
| - pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; |
249 |
| -#endif /* CONFIG_SMP */ |
| 208 | + cmpxchg(&buddy->pte, 0, _PAGE_GLOBAL); |
250 | 209 | }
|
251 | 210 | #endif
|
252 | 211 | }
|
|
0 commit comments