diff options
Diffstat (limited to 'arch/tile/lib')
-rw-r--r-- | arch/tile/lib/atomic_32.c | 53 | ||||
-rw-r--r-- | arch/tile/lib/cpumask.c | 1 | ||||
-rw-r--r-- | arch/tile/lib/exports.c | 1 | ||||
-rw-r--r-- | arch/tile/lib/memcpy_tile64.c | 6 | ||||
-rw-r--r-- | arch/tile/lib/memmove_32.c | 2 | ||||
-rw-r--r-- | arch/tile/lib/memset_32.c | 3 | ||||
-rw-r--r-- | arch/tile/lib/spinlock_common.h | 2 | ||||
-rw-r--r-- | arch/tile/lib/uaccess.c | 3 |
8 files changed, 29 insertions, 42 deletions
diff --git a/arch/tile/lib/atomic_32.c b/arch/tile/lib/atomic_32.c index be1e8acd105d..8040b42a8eea 100644 --- a/arch/tile/lib/atomic_32.c +++ b/arch/tile/lib/atomic_32.c | |||
@@ -18,27 +18,10 @@ | |||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <asm/atomic.h> | 20 | #include <asm/atomic.h> |
21 | #include <asm/futex.h> | ||
21 | #include <arch/chip.h> | 22 | #include <arch/chip.h> |
22 | 23 | ||
23 | /* The routines in atomic_asm.S are private, so we only declare them here. */ | 24 | /* See <asm/atomic_32.h> */ |
24 | extern struct __get_user __atomic_cmpxchg(volatile int *p, | ||
25 | int *lock, int o, int n); | ||
26 | extern struct __get_user __atomic_xchg(volatile int *p, int *lock, int n); | ||
27 | extern struct __get_user __atomic_xchg_add(volatile int *p, int *lock, int n); | ||
28 | extern struct __get_user __atomic_xchg_add_unless(volatile int *p, | ||
29 | int *lock, int o, int n); | ||
30 | extern struct __get_user __atomic_or(volatile int *p, int *lock, int n); | ||
31 | extern struct __get_user __atomic_andn(volatile int *p, int *lock, int n); | ||
32 | extern struct __get_user __atomic_xor(volatile int *p, int *lock, int n); | ||
33 | |||
34 | extern u64 __atomic64_cmpxchg(volatile u64 *p, int *lock, u64 o, u64 n); | ||
35 | extern u64 __atomic64_xchg(volatile u64 *p, int *lock, u64 n); | ||
36 | extern u64 __atomic64_xchg_add(volatile u64 *p, int *lock, u64 n); | ||
37 | extern u64 __atomic64_xchg_add_unless(volatile u64 *p, | ||
38 | int *lock, u64 o, u64 n); | ||
39 | |||
40 | |||
41 | /* See <asm/atomic.h> */ | ||
42 | #if ATOMIC_LOCKS_FOUND_VIA_TABLE() | 25 | #if ATOMIC_LOCKS_FOUND_VIA_TABLE() |
43 | 26 | ||
44 | /* | 27 | /* |
@@ -209,7 +192,7 @@ u64 _atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n) | |||
209 | EXPORT_SYMBOL(_atomic64_cmpxchg); | 192 | EXPORT_SYMBOL(_atomic64_cmpxchg); |
210 | 193 | ||
211 | 194 | ||
212 | static inline int *__futex_setup(__user int *v) | 195 | static inline int *__futex_setup(int __user *v) |
213 | { | 196 | { |
214 | /* | 197 | /* |
215 | * Issue a prefetch to the counter to bring it into cache. | 198 | * Issue a prefetch to the counter to bring it into cache. |
@@ -217,37 +200,37 @@ static inline int *__futex_setup(__user int *v) | |||
217 | * since it might fault; instead we do a prefetch into the L2. | 200 | * since it might fault; instead we do a prefetch into the L2. |
218 | */ | 201 | */ |
219 | __insn_prefetch(v); | 202 | __insn_prefetch(v); |
220 | return __atomic_hashed_lock(v); | 203 | return __atomic_hashed_lock((int __force *)v); |
221 | } | 204 | } |
222 | 205 | ||
223 | struct __get_user futex_set(int *v, int i) | 206 | struct __get_user futex_set(int __user *v, int i) |
224 | { | 207 | { |
225 | return __atomic_xchg(v, __futex_setup(v), i); | 208 | return __atomic_xchg((int __force *)v, __futex_setup(v), i); |
226 | } | 209 | } |
227 | 210 | ||
228 | struct __get_user futex_add(int *v, int n) | 211 | struct __get_user futex_add(int __user *v, int n) |
229 | { | 212 | { |
230 | return __atomic_xchg_add(v, __futex_setup(v), n); | 213 | return __atomic_xchg_add((int __force *)v, __futex_setup(v), n); |
231 | } | 214 | } |
232 | 215 | ||
233 | struct __get_user futex_or(int *v, int n) | 216 | struct __get_user futex_or(int __user *v, int n) |
234 | { | 217 | { |
235 | return __atomic_or(v, __futex_setup(v), n); | 218 | return __atomic_or((int __force *)v, __futex_setup(v), n); |
236 | } | 219 | } |
237 | 220 | ||
238 | struct __get_user futex_andn(int *v, int n) | 221 | struct __get_user futex_andn(int __user *v, int n) |
239 | { | 222 | { |
240 | return __atomic_andn(v, __futex_setup(v), n); | 223 | return __atomic_andn((int __force *)v, __futex_setup(v), n); |
241 | } | 224 | } |
242 | 225 | ||
243 | struct __get_user futex_xor(int *v, int n) | 226 | struct __get_user futex_xor(int __user *v, int n) |
244 | { | 227 | { |
245 | return __atomic_xor(v, __futex_setup(v), n); | 228 | return __atomic_xor((int __force *)v, __futex_setup(v), n); |
246 | } | 229 | } |
247 | 230 | ||
248 | struct __get_user futex_cmpxchg(int *v, int o, int n) | 231 | struct __get_user futex_cmpxchg(int __user *v, int o, int n) |
249 | { | 232 | { |
250 | return __atomic_cmpxchg(v, __futex_setup(v), o, n); | 233 | return __atomic_cmpxchg((int __force *)v, __futex_setup(v), o, n); |
251 | } | 234 | } |
252 | 235 | ||
253 | /* | 236 | /* |
@@ -260,7 +243,7 @@ struct __get_user futex_cmpxchg(int *v, int o, int n) | |||
260 | * invoked in is the context of the "_atomic_xxx()" routines called | 243 | * invoked in is the context of the "_atomic_xxx()" routines called |
261 | * by the functions in this file. | 244 | * by the functions in this file. |
262 | */ | 245 | */ |
263 | struct __get_user __atomic_bad_address(int *addr) | 246 | struct __get_user __atomic_bad_address(int __user *addr) |
264 | { | 247 | { |
265 | if (unlikely(!access_ok(VERIFY_WRITE, addr, sizeof(int)))) | 248 | if (unlikely(!access_ok(VERIFY_WRITE, addr, sizeof(int)))) |
266 | panic("Bad address used for kernel atomic op: %p\n", addr); | 249 | panic("Bad address used for kernel atomic op: %p\n", addr); |
@@ -271,7 +254,7 @@ struct __get_user __atomic_bad_address(int *addr) | |||
271 | #if CHIP_HAS_CBOX_HOME_MAP() | 254 | #if CHIP_HAS_CBOX_HOME_MAP() |
272 | static int __init noatomichash(char *str) | 255 | static int __init noatomichash(char *str) |
273 | { | 256 | { |
274 | printk("noatomichash is deprecated.\n"); | 257 | pr_warning("noatomichash is deprecated.\n"); |
275 | return 1; | 258 | return 1; |
276 | } | 259 | } |
277 | __setup("noatomichash", noatomichash); | 260 | __setup("noatomichash", noatomichash); |
diff --git a/arch/tile/lib/cpumask.c b/arch/tile/lib/cpumask.c index af745b3b2559..fdc403614d12 100644 --- a/arch/tile/lib/cpumask.c +++ b/arch/tile/lib/cpumask.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/cpumask.h> | 15 | #include <linux/cpumask.h> |
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/smp.h> | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * Allow cropping out bits beyond the end of the array. | 21 | * Allow cropping out bits beyond the end of the array. |
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c index af8e70e2a0ce..6bc7b52b4aa0 100644 --- a/arch/tile/lib/exports.c +++ b/arch/tile/lib/exports.c | |||
@@ -21,6 +21,7 @@ | |||
21 | EXPORT_SYMBOL(__get_user_1); | 21 | EXPORT_SYMBOL(__get_user_1); |
22 | EXPORT_SYMBOL(__get_user_2); | 22 | EXPORT_SYMBOL(__get_user_2); |
23 | EXPORT_SYMBOL(__get_user_4); | 23 | EXPORT_SYMBOL(__get_user_4); |
24 | EXPORT_SYMBOL(__get_user_8); | ||
24 | EXPORT_SYMBOL(__put_user_1); | 25 | EXPORT_SYMBOL(__put_user_1); |
25 | EXPORT_SYMBOL(__put_user_2); | 26 | EXPORT_SYMBOL(__put_user_2); |
26 | EXPORT_SYMBOL(__put_user_4); | 27 | EXPORT_SYMBOL(__put_user_4); |
diff --git a/arch/tile/lib/memcpy_tile64.c b/arch/tile/lib/memcpy_tile64.c index 4f0047342469..dfedea7b266b 100644 --- a/arch/tile/lib/memcpy_tile64.c +++ b/arch/tile/lib/memcpy_tile64.c | |||
@@ -60,8 +60,8 @@ typedef unsigned long (*memcpy_t)(void *, const void *, unsigned long); | |||
60 | static void memcpy_multicache(void *dest, const void *source, | 60 | static void memcpy_multicache(void *dest, const void *source, |
61 | pte_t dst_pte, pte_t src_pte, int len) | 61 | pte_t dst_pte, pte_t src_pte, int len) |
62 | { | 62 | { |
63 | int idx, i; | 63 | int idx; |
64 | unsigned long flags, newsrc, newdst, endsrc; | 64 | unsigned long flags, newsrc, newdst; |
65 | pmd_t *pmdp; | 65 | pmd_t *pmdp; |
66 | pte_t *ptep; | 66 | pte_t *ptep; |
67 | int cpu = get_cpu(); | 67 | int cpu = get_cpu(); |
@@ -121,7 +121,7 @@ static void memcpy_multicache(void *dest, const void *source, | |||
121 | */ | 121 | */ |
122 | sim_allow_multiple_caching(0); | 122 | sim_allow_multiple_caching(0); |
123 | local_irq_restore(flags); | 123 | local_irq_restore(flags); |
124 | put_cpu_no_resched(); | 124 | put_cpu(); |
125 | } | 125 | } |
126 | 126 | ||
127 | /* | 127 | /* |
diff --git a/arch/tile/lib/memmove_32.c b/arch/tile/lib/memmove_32.c index f09d8c4523ec..fd615ae6ade7 100644 --- a/arch/tile/lib/memmove_32.c +++ b/arch/tile/lib/memmove_32.c | |||
@@ -42,7 +42,7 @@ void *memmove(void *dest, const void *src, size_t n) | |||
42 | in = (const uint8_t *)src; | 42 | in = (const uint8_t *)src; |
43 | out = (uint8_t *)dest; | 43 | out = (uint8_t *)dest; |
44 | stride = 1; | 44 | stride = 1; |
45 | } | 45 | } |
46 | 46 | ||
47 | /* Manually software-pipeline this loop. */ | 47 | /* Manually software-pipeline this loop. */ |
48 | x = *in; | 48 | x = *in; |
diff --git a/arch/tile/lib/memset_32.c b/arch/tile/lib/memset_32.c index 8593bc82398a..bfde5d864df1 100644 --- a/arch/tile/lib/memset_32.c +++ b/arch/tile/lib/memset_32.c | |||
@@ -245,7 +245,8 @@ void *memset(void *s, int c, size_t n) | |||
245 | wh += CACHE_LINE_SIZE_IN_WORDS; | 245 | wh += CACHE_LINE_SIZE_IN_WORDS; |
246 | } while (--i); | 246 | } while (--i); |
247 | 247 | ||
248 | for (j = x * (CACHE_LINE_SIZE_IN_WORDS / 4); j != 0; j--) { | 248 | for (j = x * (CACHE_LINE_SIZE_IN_WORDS / 4); |
249 | j != 0; j--) { | ||
249 | *out32++ = v32; | 250 | *out32++ = v32; |
250 | *out32++ = v32; | 251 | *out32++ = v32; |
251 | *out32++ = v32; | 252 | *out32++ = v32; |
diff --git a/arch/tile/lib/spinlock_common.h b/arch/tile/lib/spinlock_common.h index 8dffebde6630..c10109809132 100644 --- a/arch/tile/lib/spinlock_common.h +++ b/arch/tile/lib/spinlock_common.h | |||
@@ -35,7 +35,7 @@ relax(int iterations) | |||
35 | } | 35 | } |
36 | 36 | ||
37 | /* Perform bounded exponential backoff.*/ | 37 | /* Perform bounded exponential backoff.*/ |
38 | void delay_backoff(int iterations) | 38 | static void delay_backoff(int iterations) |
39 | { | 39 | { |
40 | u32 exponent, loops; | 40 | u32 exponent, loops; |
41 | 41 | ||
diff --git a/arch/tile/lib/uaccess.c b/arch/tile/lib/uaccess.c index 9ae182568b77..f8d398c9ee7f 100644 --- a/arch/tile/lib/uaccess.c +++ b/arch/tile/lib/uaccess.c | |||
@@ -18,14 +18,15 @@ | |||
18 | int __range_ok(unsigned long addr, unsigned long size) | 18 | int __range_ok(unsigned long addr, unsigned long size) |
19 | { | 19 | { |
20 | unsigned long limit = current_thread_info()->addr_limit.seg; | 20 | unsigned long limit = current_thread_info()->addr_limit.seg; |
21 | __chk_user_ptr(addr); | ||
22 | return !((addr < limit && size <= limit - addr) || | 21 | return !((addr < limit && size <= limit - addr) || |
23 | is_arch_mappable_range(addr, size)); | 22 | is_arch_mappable_range(addr, size)); |
24 | } | 23 | } |
25 | EXPORT_SYMBOL(__range_ok); | 24 | EXPORT_SYMBOL(__range_ok); |
26 | 25 | ||
26 | #ifdef CONFIG_DEBUG_COPY_FROM_USER | ||
27 | void copy_from_user_overflow(void) | 27 | void copy_from_user_overflow(void) |
28 | { | 28 | { |
29 | WARN(1, "Buffer overflow detected!\n"); | 29 | WARN(1, "Buffer overflow detected!\n"); |
30 | } | 30 | } |
31 | EXPORT_SYMBOL(copy_from_user_overflow); | 31 | EXPORT_SYMBOL(copy_from_user_overflow); |
32 | #endif | ||