diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2012-04-19 16:06:26 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-04-19 16:06:26 -0400 |
commit | eac0556750e727ff39144a9a9e59d5ccf1fc0e2a (patch) | |
tree | f5ccff7795b2ad5e47f17fb475599c526f533e79 /arch/alpha | |
parent | f71fa31f9f7ac33cba12b8897983f950ad2c7a5b (diff) | |
parent | 19853301ef3289bda2d5264c1093e74efddaeab9 (diff) |
Merge branch 'linus' into queue
Merge reason: development work has dependency on kvm patches merged
upstream.
Conflicts:
Documentation/feature-removal-schedule.txt
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/include/asm/atomic.h | 68 | ||||
-rw-r--r-- | arch/alpha/include/asm/cmpxchg.h | 71 | ||||
-rw-r--r-- | arch/alpha/include/asm/xchg.h | 4 |
3 files changed, 74 insertions, 69 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index f62251e82ffa..3bb7ffeae3bc 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/barrier.h> | 5 | #include <asm/barrier.h> |
6 | #include <asm/cmpxchg.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Atomic operations that C can't guarantee us. Useful for | 9 | * Atomic operations that C can't guarantee us. Useful for |
@@ -168,73 +169,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v) | |||
168 | return result; | 169 | return result; |
169 | } | 170 | } |
170 | 171 | ||
171 | /* | ||
172 | * Atomic exchange routines. | ||
173 | */ | ||
174 | |||
175 | #define __ASM__MB | ||
176 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
177 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
178 | #include <asm/xchg.h> | ||
179 | |||
180 | #define xchg_local(ptr,x) \ | ||
181 | ({ \ | ||
182 | __typeof__(*(ptr)) _x_ = (x); \ | ||
183 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
184 | sizeof(*(ptr))); \ | ||
185 | }) | ||
186 | |||
187 | #define cmpxchg_local(ptr, o, n) \ | ||
188 | ({ \ | ||
189 | __typeof__(*(ptr)) _o_ = (o); \ | ||
190 | __typeof__(*(ptr)) _n_ = (n); \ | ||
191 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
192 | (unsigned long)_n_, \ | ||
193 | sizeof(*(ptr))); \ | ||
194 | }) | ||
195 | |||
196 | #define cmpxchg64_local(ptr, o, n) \ | ||
197 | ({ \ | ||
198 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
199 | cmpxchg_local((ptr), (o), (n)); \ | ||
200 | }) | ||
201 | |||
202 | #ifdef CONFIG_SMP | ||
203 | #undef __ASM__MB | ||
204 | #define __ASM__MB "\tmb\n" | ||
205 | #endif | ||
206 | #undef ____xchg | ||
207 | #undef ____cmpxchg | ||
208 | #define ____xchg(type, args...) __xchg ##type(args) | ||
209 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
210 | #include <asm/xchg.h> | ||
211 | |||
212 | #define xchg(ptr,x) \ | ||
213 | ({ \ | ||
214 | __typeof__(*(ptr)) _x_ = (x); \ | ||
215 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
216 | sizeof(*(ptr))); \ | ||
217 | }) | ||
218 | |||
219 | #define cmpxchg(ptr, o, n) \ | ||
220 | ({ \ | ||
221 | __typeof__(*(ptr)) _o_ = (o); \ | ||
222 | __typeof__(*(ptr)) _n_ = (n); \ | ||
223 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
224 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
225 | }) | ||
226 | |||
227 | #define cmpxchg64(ptr, o, n) \ | ||
228 | ({ \ | ||
229 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
230 | cmpxchg((ptr), (o), (n)); \ | ||
231 | }) | ||
232 | |||
233 | #undef __ASM__MB | ||
234 | #undef ____cmpxchg | ||
235 | |||
236 | #define __HAVE_ARCH_CMPXCHG 1 | ||
237 | |||
238 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) | 172 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) |
239 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) | 173 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) |
240 | 174 | ||
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h new file mode 100644 index 000000000000..429e8cd0d78e --- /dev/null +++ b/arch/alpha/include/asm/cmpxchg.h | |||
@@ -0,0 +1,71 @@ | |||
1 | #ifndef _ALPHA_CMPXCHG_H | ||
2 | #define _ALPHA_CMPXCHG_H | ||
3 | |||
4 | /* | ||
5 | * Atomic exchange routines. | ||
6 | */ | ||
7 | |||
8 | #define __ASM__MB | ||
9 | #define ____xchg(type, args...) __xchg ## type ## _local(args) | ||
10 | #define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args) | ||
11 | #include <asm/xchg.h> | ||
12 | |||
13 | #define xchg_local(ptr, x) \ | ||
14 | ({ \ | ||
15 | __typeof__(*(ptr)) _x_ = (x); \ | ||
16 | (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \ | ||
17 | sizeof(*(ptr))); \ | ||
18 | }) | ||
19 | |||
20 | #define cmpxchg_local(ptr, o, n) \ | ||
21 | ({ \ | ||
22 | __typeof__(*(ptr)) _o_ = (o); \ | ||
23 | __typeof__(*(ptr)) _n_ = (n); \ | ||
24 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | ||
25 | (unsigned long)_n_, \ | ||
26 | sizeof(*(ptr))); \ | ||
27 | }) | ||
28 | |||
29 | #define cmpxchg64_local(ptr, o, n) \ | ||
30 | ({ \ | ||
31 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
32 | cmpxchg_local((ptr), (o), (n)); \ | ||
33 | }) | ||
34 | |||
35 | #ifdef CONFIG_SMP | ||
36 | #undef __ASM__MB | ||
37 | #define __ASM__MB "\tmb\n" | ||
38 | #endif | ||
39 | #undef ____xchg | ||
40 | #undef ____cmpxchg | ||
41 | #define ____xchg(type, args...) __xchg ##type(args) | ||
42 | #define ____cmpxchg(type, args...) __cmpxchg ##type(args) | ||
43 | #include <asm/xchg.h> | ||
44 | |||
45 | #define xchg(ptr, x) \ | ||
46 | ({ \ | ||
47 | __typeof__(*(ptr)) _x_ = (x); \ | ||
48 | (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \ | ||
49 | sizeof(*(ptr))); \ | ||
50 | }) | ||
51 | |||
52 | #define cmpxchg(ptr, o, n) \ | ||
53 | ({ \ | ||
54 | __typeof__(*(ptr)) _o_ = (o); \ | ||
55 | __typeof__(*(ptr)) _n_ = (n); \ | ||
56 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
57 | (unsigned long)_n_, sizeof(*(ptr)));\ | ||
58 | }) | ||
59 | |||
60 | #define cmpxchg64(ptr, o, n) \ | ||
61 | ({ \ | ||
62 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
63 | cmpxchg((ptr), (o), (n)); \ | ||
64 | }) | ||
65 | |||
66 | #undef __ASM__MB | ||
67 | #undef ____cmpxchg | ||
68 | |||
69 | #define __HAVE_ARCH_CMPXCHG 1 | ||
70 | |||
71 | #endif /* _ALPHA_CMPXCHG_H */ | ||
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h index 1d1b436fbff2..0ca9724597c1 100644 --- a/arch/alpha/include/asm/xchg.h +++ b/arch/alpha/include/asm/xchg.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _ALPHA_ATOMIC_H | 1 | #ifndef _ALPHA_CMPXCHG_H |
2 | #error Do not include xchg.h directly! | 2 | #error Do not include xchg.h directly! |
3 | #else | 3 | #else |
4 | /* | 4 | /* |
5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code | 5 | * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code |
6 | * except that local version do not have the expensive memory barrier. | 6 | * except that local version do not have the expensive memory barrier. |
7 | * So this file is included twice from asm/system.h. | 7 | * So this file is included twice from asm/cmpxchg.h. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |