xref: /OK3568_Linux_fs/kernel/include/asm-generic/percpu.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ASM_GENERIC_PERCPU_H_
3*4882a593Smuzhiyun #define _ASM_GENERIC_PERCPU_H_
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <linux/compiler.h>
6*4882a593Smuzhiyun #include <linux/threads.h>
7*4882a593Smuzhiyun #include <linux/percpu-defs.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifdef CONFIG_SMP
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /*
12*4882a593Smuzhiyun  * per_cpu_offset() is the offset that has to be added to a
13*4882a593Smuzhiyun  * percpu variable to get to the instance for a certain processor.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * Most arches use the __per_cpu_offset array for those offsets but
16*4882a593Smuzhiyun  * some arches have their own ways of determining the offset (x86_64, s390).
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun #ifndef __per_cpu_offset
19*4882a593Smuzhiyun extern unsigned long __per_cpu_offset[NR_CPUS];
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #define per_cpu_offset(x) (__per_cpu_offset[x])
22*4882a593Smuzhiyun #endif
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /*
25*4882a593Smuzhiyun  * Determine the offset for the currently active processor.
26*4882a593Smuzhiyun  * An arch may define __my_cpu_offset to provide a more effective
27*4882a593Smuzhiyun  * means of obtaining the offset to the per cpu variables of the
28*4882a593Smuzhiyun  * current processor.
29*4882a593Smuzhiyun  */
30*4882a593Smuzhiyun #ifndef __my_cpu_offset
31*4882a593Smuzhiyun #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
32*4882a593Smuzhiyun #endif
33*4882a593Smuzhiyun #ifdef CONFIG_DEBUG_PREEMPT
34*4882a593Smuzhiyun #define my_cpu_offset per_cpu_offset(smp_processor_id())
35*4882a593Smuzhiyun #else
36*4882a593Smuzhiyun #define my_cpu_offset __my_cpu_offset
37*4882a593Smuzhiyun #endif
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /*
40*4882a593Smuzhiyun  * Arch may define arch_raw_cpu_ptr() to provide more efficient address
41*4882a593Smuzhiyun  * translations for raw_cpu_ptr().
42*4882a593Smuzhiyun  */
43*4882a593Smuzhiyun #ifndef arch_raw_cpu_ptr
44*4882a593Smuzhiyun #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
45*4882a593Smuzhiyun #endif
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
48*4882a593Smuzhiyun extern void setup_per_cpu_areas(void);
49*4882a593Smuzhiyun #endif
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #endif	/* SMP */
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #ifndef PER_CPU_BASE_SECTION
54*4882a593Smuzhiyun #ifdef CONFIG_SMP
55*4882a593Smuzhiyun #define PER_CPU_BASE_SECTION ".data..percpu"
56*4882a593Smuzhiyun #else
57*4882a593Smuzhiyun #define PER_CPU_BASE_SECTION ".data"
58*4882a593Smuzhiyun #endif
59*4882a593Smuzhiyun #endif
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun #ifndef PER_CPU_ATTRIBUTES
62*4882a593Smuzhiyun #define PER_CPU_ATTRIBUTES
63*4882a593Smuzhiyun #endif
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun #define raw_cpu_generic_read(pcp)					\
66*4882a593Smuzhiyun ({									\
67*4882a593Smuzhiyun 	*raw_cpu_ptr(&(pcp));						\
68*4882a593Smuzhiyun })
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun #define raw_cpu_generic_to_op(pcp, val, op)				\
71*4882a593Smuzhiyun do {									\
72*4882a593Smuzhiyun 	*raw_cpu_ptr(&(pcp)) op val;					\
73*4882a593Smuzhiyun } while (0)
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #define raw_cpu_generic_add_return(pcp, val)				\
76*4882a593Smuzhiyun ({									\
77*4882a593Smuzhiyun 	typeof(pcp) *__p = raw_cpu_ptr(&(pcp));				\
78*4882a593Smuzhiyun 									\
79*4882a593Smuzhiyun 	*__p += val;							\
80*4882a593Smuzhiyun 	*__p;								\
81*4882a593Smuzhiyun })
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun #define raw_cpu_generic_xchg(pcp, nval)					\
84*4882a593Smuzhiyun ({									\
85*4882a593Smuzhiyun 	typeof(pcp) *__p = raw_cpu_ptr(&(pcp));				\
86*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
87*4882a593Smuzhiyun 	__ret = *__p;							\
88*4882a593Smuzhiyun 	*__p = nval;							\
89*4882a593Smuzhiyun 	__ret;								\
90*4882a593Smuzhiyun })
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun #define raw_cpu_generic_cmpxchg(pcp, oval, nval)			\
93*4882a593Smuzhiyun ({									\
94*4882a593Smuzhiyun 	typeof(pcp) *__p = raw_cpu_ptr(&(pcp));				\
95*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
96*4882a593Smuzhiyun 	__ret = *__p;							\
97*4882a593Smuzhiyun 	if (__ret == (oval))						\
98*4882a593Smuzhiyun 		*__p = nval;						\
99*4882a593Smuzhiyun 	__ret;								\
100*4882a593Smuzhiyun })
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun #define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
103*4882a593Smuzhiyun ({									\
104*4882a593Smuzhiyun 	typeof(pcp1) *__p1 = raw_cpu_ptr(&(pcp1));			\
105*4882a593Smuzhiyun 	typeof(pcp2) *__p2 = raw_cpu_ptr(&(pcp2));			\
106*4882a593Smuzhiyun 	int __ret = 0;							\
107*4882a593Smuzhiyun 	if (*__p1 == (oval1) && *__p2  == (oval2)) {			\
108*4882a593Smuzhiyun 		*__p1 = nval1;						\
109*4882a593Smuzhiyun 		*__p2 = nval2;						\
110*4882a593Smuzhiyun 		__ret = 1;						\
111*4882a593Smuzhiyun 	}								\
112*4882a593Smuzhiyun 	(__ret);							\
113*4882a593Smuzhiyun })
114*4882a593Smuzhiyun 
115*4882a593Smuzhiyun #define __this_cpu_generic_read_nopreempt(pcp)				\
116*4882a593Smuzhiyun ({									\
117*4882a593Smuzhiyun 	typeof(pcp) ___ret;						\
118*4882a593Smuzhiyun 	preempt_disable_notrace();					\
119*4882a593Smuzhiyun 	___ret = READ_ONCE(*raw_cpu_ptr(&(pcp)));			\
120*4882a593Smuzhiyun 	preempt_enable_notrace();					\
121*4882a593Smuzhiyun 	___ret;								\
122*4882a593Smuzhiyun })
123*4882a593Smuzhiyun 
124*4882a593Smuzhiyun #define __this_cpu_generic_read_noirq(pcp)				\
125*4882a593Smuzhiyun ({									\
126*4882a593Smuzhiyun 	typeof(pcp) ___ret;						\
127*4882a593Smuzhiyun 	unsigned long ___flags;						\
128*4882a593Smuzhiyun 	raw_local_irq_save(___flags);					\
129*4882a593Smuzhiyun 	___ret = raw_cpu_generic_read(pcp);				\
130*4882a593Smuzhiyun 	raw_local_irq_restore(___flags);				\
131*4882a593Smuzhiyun 	___ret;								\
132*4882a593Smuzhiyun })
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun #define this_cpu_generic_read(pcp)					\
135*4882a593Smuzhiyun ({									\
136*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
137*4882a593Smuzhiyun 	if (__native_word(pcp))						\
138*4882a593Smuzhiyun 		__ret = __this_cpu_generic_read_nopreempt(pcp);		\
139*4882a593Smuzhiyun 	else								\
140*4882a593Smuzhiyun 		__ret = __this_cpu_generic_read_noirq(pcp);		\
141*4882a593Smuzhiyun 	__ret;								\
142*4882a593Smuzhiyun })
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun #define this_cpu_generic_to_op(pcp, val, op)				\
145*4882a593Smuzhiyun do {									\
146*4882a593Smuzhiyun 	unsigned long __flags;						\
147*4882a593Smuzhiyun 	raw_local_irq_save(__flags);					\
148*4882a593Smuzhiyun 	raw_cpu_generic_to_op(pcp, val, op);				\
149*4882a593Smuzhiyun 	raw_local_irq_restore(__flags);					\
150*4882a593Smuzhiyun } while (0)
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun #define this_cpu_generic_add_return(pcp, val)				\
154*4882a593Smuzhiyun ({									\
155*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
156*4882a593Smuzhiyun 	unsigned long __flags;						\
157*4882a593Smuzhiyun 	raw_local_irq_save(__flags);					\
158*4882a593Smuzhiyun 	__ret = raw_cpu_generic_add_return(pcp, val);			\
159*4882a593Smuzhiyun 	raw_local_irq_restore(__flags);					\
160*4882a593Smuzhiyun 	__ret;								\
161*4882a593Smuzhiyun })
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun #define this_cpu_generic_xchg(pcp, nval)				\
164*4882a593Smuzhiyun ({									\
165*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
166*4882a593Smuzhiyun 	unsigned long __flags;						\
167*4882a593Smuzhiyun 	raw_local_irq_save(__flags);					\
168*4882a593Smuzhiyun 	__ret = raw_cpu_generic_xchg(pcp, nval);			\
169*4882a593Smuzhiyun 	raw_local_irq_restore(__flags);					\
170*4882a593Smuzhiyun 	__ret;								\
171*4882a593Smuzhiyun })
172*4882a593Smuzhiyun 
173*4882a593Smuzhiyun #define this_cpu_generic_cmpxchg(pcp, oval, nval)			\
174*4882a593Smuzhiyun ({									\
175*4882a593Smuzhiyun 	typeof(pcp) __ret;						\
176*4882a593Smuzhiyun 	unsigned long __flags;						\
177*4882a593Smuzhiyun 	raw_local_irq_save(__flags);					\
178*4882a593Smuzhiyun 	__ret = raw_cpu_generic_cmpxchg(pcp, oval, nval);		\
179*4882a593Smuzhiyun 	raw_local_irq_restore(__flags);					\
180*4882a593Smuzhiyun 	__ret;								\
181*4882a593Smuzhiyun })
182*4882a593Smuzhiyun 
183*4882a593Smuzhiyun #define this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)	\
184*4882a593Smuzhiyun ({									\
185*4882a593Smuzhiyun 	int __ret;							\
186*4882a593Smuzhiyun 	unsigned long __flags;						\
187*4882a593Smuzhiyun 	raw_local_irq_save(__flags);					\
188*4882a593Smuzhiyun 	__ret = raw_cpu_generic_cmpxchg_double(pcp1, pcp2,		\
189*4882a593Smuzhiyun 			oval1, oval2, nval1, nval2);			\
190*4882a593Smuzhiyun 	raw_local_irq_restore(__flags);					\
191*4882a593Smuzhiyun 	__ret;								\
192*4882a593Smuzhiyun })
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun #ifndef raw_cpu_read_1
195*4882a593Smuzhiyun #define raw_cpu_read_1(pcp)		raw_cpu_generic_read(pcp)
196*4882a593Smuzhiyun #endif
197*4882a593Smuzhiyun #ifndef raw_cpu_read_2
198*4882a593Smuzhiyun #define raw_cpu_read_2(pcp)		raw_cpu_generic_read(pcp)
199*4882a593Smuzhiyun #endif
200*4882a593Smuzhiyun #ifndef raw_cpu_read_4
201*4882a593Smuzhiyun #define raw_cpu_read_4(pcp)		raw_cpu_generic_read(pcp)
202*4882a593Smuzhiyun #endif
203*4882a593Smuzhiyun #ifndef raw_cpu_read_8
204*4882a593Smuzhiyun #define raw_cpu_read_8(pcp)		raw_cpu_generic_read(pcp)
205*4882a593Smuzhiyun #endif
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun #ifndef raw_cpu_write_1
208*4882a593Smuzhiyun #define raw_cpu_write_1(pcp, val)	raw_cpu_generic_to_op(pcp, val, =)
209*4882a593Smuzhiyun #endif
210*4882a593Smuzhiyun #ifndef raw_cpu_write_2
211*4882a593Smuzhiyun #define raw_cpu_write_2(pcp, val)	raw_cpu_generic_to_op(pcp, val, =)
212*4882a593Smuzhiyun #endif
213*4882a593Smuzhiyun #ifndef raw_cpu_write_4
214*4882a593Smuzhiyun #define raw_cpu_write_4(pcp, val)	raw_cpu_generic_to_op(pcp, val, =)
215*4882a593Smuzhiyun #endif
216*4882a593Smuzhiyun #ifndef raw_cpu_write_8
217*4882a593Smuzhiyun #define raw_cpu_write_8(pcp, val)	raw_cpu_generic_to_op(pcp, val, =)
218*4882a593Smuzhiyun #endif
219*4882a593Smuzhiyun 
220*4882a593Smuzhiyun #ifndef raw_cpu_add_1
221*4882a593Smuzhiyun #define raw_cpu_add_1(pcp, val)		raw_cpu_generic_to_op(pcp, val, +=)
222*4882a593Smuzhiyun #endif
223*4882a593Smuzhiyun #ifndef raw_cpu_add_2
224*4882a593Smuzhiyun #define raw_cpu_add_2(pcp, val)		raw_cpu_generic_to_op(pcp, val, +=)
225*4882a593Smuzhiyun #endif
226*4882a593Smuzhiyun #ifndef raw_cpu_add_4
227*4882a593Smuzhiyun #define raw_cpu_add_4(pcp, val)		raw_cpu_generic_to_op(pcp, val, +=)
228*4882a593Smuzhiyun #endif
229*4882a593Smuzhiyun #ifndef raw_cpu_add_8
230*4882a593Smuzhiyun #define raw_cpu_add_8(pcp, val)		raw_cpu_generic_to_op(pcp, val, +=)
231*4882a593Smuzhiyun #endif
232*4882a593Smuzhiyun 
233*4882a593Smuzhiyun #ifndef raw_cpu_and_1
234*4882a593Smuzhiyun #define raw_cpu_and_1(pcp, val)		raw_cpu_generic_to_op(pcp, val, &=)
235*4882a593Smuzhiyun #endif
236*4882a593Smuzhiyun #ifndef raw_cpu_and_2
237*4882a593Smuzhiyun #define raw_cpu_and_2(pcp, val)		raw_cpu_generic_to_op(pcp, val, &=)
238*4882a593Smuzhiyun #endif
239*4882a593Smuzhiyun #ifndef raw_cpu_and_4
240*4882a593Smuzhiyun #define raw_cpu_and_4(pcp, val)		raw_cpu_generic_to_op(pcp, val, &=)
241*4882a593Smuzhiyun #endif
242*4882a593Smuzhiyun #ifndef raw_cpu_and_8
243*4882a593Smuzhiyun #define raw_cpu_and_8(pcp, val)		raw_cpu_generic_to_op(pcp, val, &=)
244*4882a593Smuzhiyun #endif
245*4882a593Smuzhiyun 
246*4882a593Smuzhiyun #ifndef raw_cpu_or_1
247*4882a593Smuzhiyun #define raw_cpu_or_1(pcp, val)		raw_cpu_generic_to_op(pcp, val, |=)
248*4882a593Smuzhiyun #endif
249*4882a593Smuzhiyun #ifndef raw_cpu_or_2
250*4882a593Smuzhiyun #define raw_cpu_or_2(pcp, val)		raw_cpu_generic_to_op(pcp, val, |=)
251*4882a593Smuzhiyun #endif
252*4882a593Smuzhiyun #ifndef raw_cpu_or_4
253*4882a593Smuzhiyun #define raw_cpu_or_4(pcp, val)		raw_cpu_generic_to_op(pcp, val, |=)
254*4882a593Smuzhiyun #endif
255*4882a593Smuzhiyun #ifndef raw_cpu_or_8
256*4882a593Smuzhiyun #define raw_cpu_or_8(pcp, val)		raw_cpu_generic_to_op(pcp, val, |=)
257*4882a593Smuzhiyun #endif
258*4882a593Smuzhiyun 
259*4882a593Smuzhiyun #ifndef raw_cpu_add_return_1
260*4882a593Smuzhiyun #define raw_cpu_add_return_1(pcp, val)	raw_cpu_generic_add_return(pcp, val)
261*4882a593Smuzhiyun #endif
262*4882a593Smuzhiyun #ifndef raw_cpu_add_return_2
263*4882a593Smuzhiyun #define raw_cpu_add_return_2(pcp, val)	raw_cpu_generic_add_return(pcp, val)
264*4882a593Smuzhiyun #endif
265*4882a593Smuzhiyun #ifndef raw_cpu_add_return_4
266*4882a593Smuzhiyun #define raw_cpu_add_return_4(pcp, val)	raw_cpu_generic_add_return(pcp, val)
267*4882a593Smuzhiyun #endif
268*4882a593Smuzhiyun #ifndef raw_cpu_add_return_8
269*4882a593Smuzhiyun #define raw_cpu_add_return_8(pcp, val)	raw_cpu_generic_add_return(pcp, val)
270*4882a593Smuzhiyun #endif
271*4882a593Smuzhiyun 
272*4882a593Smuzhiyun #ifndef raw_cpu_xchg_1
273*4882a593Smuzhiyun #define raw_cpu_xchg_1(pcp, nval)	raw_cpu_generic_xchg(pcp, nval)
274*4882a593Smuzhiyun #endif
275*4882a593Smuzhiyun #ifndef raw_cpu_xchg_2
276*4882a593Smuzhiyun #define raw_cpu_xchg_2(pcp, nval)	raw_cpu_generic_xchg(pcp, nval)
277*4882a593Smuzhiyun #endif
278*4882a593Smuzhiyun #ifndef raw_cpu_xchg_4
279*4882a593Smuzhiyun #define raw_cpu_xchg_4(pcp, nval)	raw_cpu_generic_xchg(pcp, nval)
280*4882a593Smuzhiyun #endif
281*4882a593Smuzhiyun #ifndef raw_cpu_xchg_8
282*4882a593Smuzhiyun #define raw_cpu_xchg_8(pcp, nval)	raw_cpu_generic_xchg(pcp, nval)
283*4882a593Smuzhiyun #endif
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_1
286*4882a593Smuzhiyun #define raw_cpu_cmpxchg_1(pcp, oval, nval) \
287*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg(pcp, oval, nval)
288*4882a593Smuzhiyun #endif
289*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_2
290*4882a593Smuzhiyun #define raw_cpu_cmpxchg_2(pcp, oval, nval) \
291*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg(pcp, oval, nval)
292*4882a593Smuzhiyun #endif
293*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_4
294*4882a593Smuzhiyun #define raw_cpu_cmpxchg_4(pcp, oval, nval) \
295*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg(pcp, oval, nval)
296*4882a593Smuzhiyun #endif
297*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_8
298*4882a593Smuzhiyun #define raw_cpu_cmpxchg_8(pcp, oval, nval) \
299*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg(pcp, oval, nval)
300*4882a593Smuzhiyun #endif
301*4882a593Smuzhiyun 
302*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_double_1
303*4882a593Smuzhiyun #define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
304*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
305*4882a593Smuzhiyun #endif
306*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_double_2
307*4882a593Smuzhiyun #define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
308*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
309*4882a593Smuzhiyun #endif
310*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_double_4
311*4882a593Smuzhiyun #define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
312*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
313*4882a593Smuzhiyun #endif
314*4882a593Smuzhiyun #ifndef raw_cpu_cmpxchg_double_8
315*4882a593Smuzhiyun #define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
316*4882a593Smuzhiyun 	raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
317*4882a593Smuzhiyun #endif
318*4882a593Smuzhiyun 
319*4882a593Smuzhiyun #ifndef this_cpu_read_1
320*4882a593Smuzhiyun #define this_cpu_read_1(pcp)		this_cpu_generic_read(pcp)
321*4882a593Smuzhiyun #endif
322*4882a593Smuzhiyun #ifndef this_cpu_read_2
323*4882a593Smuzhiyun #define this_cpu_read_2(pcp)		this_cpu_generic_read(pcp)
324*4882a593Smuzhiyun #endif
325*4882a593Smuzhiyun #ifndef this_cpu_read_4
326*4882a593Smuzhiyun #define this_cpu_read_4(pcp)		this_cpu_generic_read(pcp)
327*4882a593Smuzhiyun #endif
328*4882a593Smuzhiyun #ifndef this_cpu_read_8
329*4882a593Smuzhiyun #define this_cpu_read_8(pcp)		this_cpu_generic_read(pcp)
330*4882a593Smuzhiyun #endif
331*4882a593Smuzhiyun 
332*4882a593Smuzhiyun #ifndef this_cpu_write_1
333*4882a593Smuzhiyun #define this_cpu_write_1(pcp, val)	this_cpu_generic_to_op(pcp, val, =)
334*4882a593Smuzhiyun #endif
335*4882a593Smuzhiyun #ifndef this_cpu_write_2
336*4882a593Smuzhiyun #define this_cpu_write_2(pcp, val)	this_cpu_generic_to_op(pcp, val, =)
337*4882a593Smuzhiyun #endif
338*4882a593Smuzhiyun #ifndef this_cpu_write_4
339*4882a593Smuzhiyun #define this_cpu_write_4(pcp, val)	this_cpu_generic_to_op(pcp, val, =)
340*4882a593Smuzhiyun #endif
341*4882a593Smuzhiyun #ifndef this_cpu_write_8
342*4882a593Smuzhiyun #define this_cpu_write_8(pcp, val)	this_cpu_generic_to_op(pcp, val, =)
343*4882a593Smuzhiyun #endif
344*4882a593Smuzhiyun 
345*4882a593Smuzhiyun #ifndef this_cpu_add_1
346*4882a593Smuzhiyun #define this_cpu_add_1(pcp, val)	this_cpu_generic_to_op(pcp, val, +=)
347*4882a593Smuzhiyun #endif
348*4882a593Smuzhiyun #ifndef this_cpu_add_2
349*4882a593Smuzhiyun #define this_cpu_add_2(pcp, val)	this_cpu_generic_to_op(pcp, val, +=)
350*4882a593Smuzhiyun #endif
351*4882a593Smuzhiyun #ifndef this_cpu_add_4
352*4882a593Smuzhiyun #define this_cpu_add_4(pcp, val)	this_cpu_generic_to_op(pcp, val, +=)
353*4882a593Smuzhiyun #endif
354*4882a593Smuzhiyun #ifndef this_cpu_add_8
355*4882a593Smuzhiyun #define this_cpu_add_8(pcp, val)	this_cpu_generic_to_op(pcp, val, +=)
356*4882a593Smuzhiyun #endif
357*4882a593Smuzhiyun 
358*4882a593Smuzhiyun #ifndef this_cpu_and_1
359*4882a593Smuzhiyun #define this_cpu_and_1(pcp, val)	this_cpu_generic_to_op(pcp, val, &=)
360*4882a593Smuzhiyun #endif
361*4882a593Smuzhiyun #ifndef this_cpu_and_2
362*4882a593Smuzhiyun #define this_cpu_and_2(pcp, val)	this_cpu_generic_to_op(pcp, val, &=)
363*4882a593Smuzhiyun #endif
364*4882a593Smuzhiyun #ifndef this_cpu_and_4
365*4882a593Smuzhiyun #define this_cpu_and_4(pcp, val)	this_cpu_generic_to_op(pcp, val, &=)
366*4882a593Smuzhiyun #endif
367*4882a593Smuzhiyun #ifndef this_cpu_and_8
368*4882a593Smuzhiyun #define this_cpu_and_8(pcp, val)	this_cpu_generic_to_op(pcp, val, &=)
369*4882a593Smuzhiyun #endif
370*4882a593Smuzhiyun 
371*4882a593Smuzhiyun #ifndef this_cpu_or_1
372*4882a593Smuzhiyun #define this_cpu_or_1(pcp, val)		this_cpu_generic_to_op(pcp, val, |=)
373*4882a593Smuzhiyun #endif
374*4882a593Smuzhiyun #ifndef this_cpu_or_2
375*4882a593Smuzhiyun #define this_cpu_or_2(pcp, val)		this_cpu_generic_to_op(pcp, val, |=)
376*4882a593Smuzhiyun #endif
377*4882a593Smuzhiyun #ifndef this_cpu_or_4
378*4882a593Smuzhiyun #define this_cpu_or_4(pcp, val)		this_cpu_generic_to_op(pcp, val, |=)
379*4882a593Smuzhiyun #endif
380*4882a593Smuzhiyun #ifndef this_cpu_or_8
381*4882a593Smuzhiyun #define this_cpu_or_8(pcp, val)		this_cpu_generic_to_op(pcp, val, |=)
382*4882a593Smuzhiyun #endif
383*4882a593Smuzhiyun 
384*4882a593Smuzhiyun #ifndef this_cpu_add_return_1
385*4882a593Smuzhiyun #define this_cpu_add_return_1(pcp, val)	this_cpu_generic_add_return(pcp, val)
386*4882a593Smuzhiyun #endif
387*4882a593Smuzhiyun #ifndef this_cpu_add_return_2
388*4882a593Smuzhiyun #define this_cpu_add_return_2(pcp, val)	this_cpu_generic_add_return(pcp, val)
389*4882a593Smuzhiyun #endif
390*4882a593Smuzhiyun #ifndef this_cpu_add_return_4
391*4882a593Smuzhiyun #define this_cpu_add_return_4(pcp, val)	this_cpu_generic_add_return(pcp, val)
392*4882a593Smuzhiyun #endif
393*4882a593Smuzhiyun #ifndef this_cpu_add_return_8
394*4882a593Smuzhiyun #define this_cpu_add_return_8(pcp, val)	this_cpu_generic_add_return(pcp, val)
395*4882a593Smuzhiyun #endif
396*4882a593Smuzhiyun 
397*4882a593Smuzhiyun #ifndef this_cpu_xchg_1
398*4882a593Smuzhiyun #define this_cpu_xchg_1(pcp, nval)	this_cpu_generic_xchg(pcp, nval)
399*4882a593Smuzhiyun #endif
400*4882a593Smuzhiyun #ifndef this_cpu_xchg_2
401*4882a593Smuzhiyun #define this_cpu_xchg_2(pcp, nval)	this_cpu_generic_xchg(pcp, nval)
402*4882a593Smuzhiyun #endif
403*4882a593Smuzhiyun #ifndef this_cpu_xchg_4
404*4882a593Smuzhiyun #define this_cpu_xchg_4(pcp, nval)	this_cpu_generic_xchg(pcp, nval)
405*4882a593Smuzhiyun #endif
406*4882a593Smuzhiyun #ifndef this_cpu_xchg_8
407*4882a593Smuzhiyun #define this_cpu_xchg_8(pcp, nval)	this_cpu_generic_xchg(pcp, nval)
408*4882a593Smuzhiyun #endif
409*4882a593Smuzhiyun 
410*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_1
411*4882a593Smuzhiyun #define this_cpu_cmpxchg_1(pcp, oval, nval) \
412*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg(pcp, oval, nval)
413*4882a593Smuzhiyun #endif
414*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_2
415*4882a593Smuzhiyun #define this_cpu_cmpxchg_2(pcp, oval, nval) \
416*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg(pcp, oval, nval)
417*4882a593Smuzhiyun #endif
418*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_4
419*4882a593Smuzhiyun #define this_cpu_cmpxchg_4(pcp, oval, nval) \
420*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg(pcp, oval, nval)
421*4882a593Smuzhiyun #endif
422*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_8
423*4882a593Smuzhiyun #define this_cpu_cmpxchg_8(pcp, oval, nval) \
424*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg(pcp, oval, nval)
425*4882a593Smuzhiyun #endif
426*4882a593Smuzhiyun 
427*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_double_1
428*4882a593Smuzhiyun #define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
429*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
430*4882a593Smuzhiyun #endif
431*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_double_2
432*4882a593Smuzhiyun #define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
433*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
434*4882a593Smuzhiyun #endif
435*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_double_4
436*4882a593Smuzhiyun #define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
437*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
438*4882a593Smuzhiyun #endif
439*4882a593Smuzhiyun #ifndef this_cpu_cmpxchg_double_8
440*4882a593Smuzhiyun #define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
441*4882a593Smuzhiyun 	this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
442*4882a593Smuzhiyun #endif
443*4882a593Smuzhiyun 
444*4882a593Smuzhiyun #endif /* _ASM_GENERIC_PERCPU_H_ */
445