Go to the documentation of this file. 1 #ifndef __ARCH_S390_PERCPU__
2 #define __ARCH_S390_PERCPU__
5 #include <asm/cmpxchg.h>
11 #define __my_cpu_offset S390_lowcore.percpu_offset
18 #if defined(CONFIG_SMP) && defined(CONFIG_64BIT) && defined(MODULE)
19 #define ARCH_NEEDS_WEAK_PER_CPU
22 #define arch_this_cpu_to_op(pcp, val, op) \
24 typedef typeof(pcp) pcp_op_T__; \
25 pcp_op_T__ old__, new__, prev__; \
28 ptr__ = __this_cpu_ptr(&(pcp)); \
32 new__ = old__ op (val); \
33 switch (sizeof(*ptr__)) { \
35 prev__ = cmpxchg64(ptr__, old__, new__); \
38 prev__ = cmpxchg(ptr__, old__, new__); \
40 } while (prev__ != old__); \
45 #define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +)
46 #define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +)
47 #define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +)
48 #define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +)
50 #define this_cpu_add_return_1(pcp, val) arch_this_cpu_to_op(pcp, val, +)
51 #define this_cpu_add_return_2(pcp, val) arch_this_cpu_to_op(pcp, val, +)
52 #define this_cpu_add_return_4(pcp, val) arch_this_cpu_to_op(pcp, val, +)
53 #define this_cpu_add_return_8(pcp, val) arch_this_cpu_to_op(pcp, val, +)
55 #define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &)
56 #define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &)
57 #define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &)
58 #define this_cpu_and_8(pcp, val) arch_this_cpu_to_op(pcp, val, &)
60 #define this_cpu_or_1(pcp, val) arch_this_cpu_to_op(pcp, val, |)
61 #define this_cpu_or_2(pcp, val) arch_this_cpu_to_op(pcp, val, |)
62 #define this_cpu_or_4(pcp, val) arch_this_cpu_to_op(pcp, val, |)
63 #define this_cpu_or_8(pcp, val) arch_this_cpu_to_op(pcp, val, |)
65 #define this_cpu_xor_1(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
66 #define this_cpu_xor_2(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
67 #define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
68 #define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^)
70 #define arch_this_cpu_cmpxchg(pcp, oval, nval) \
72 typedef typeof(pcp) pcp_op_T__; \
76 ptr__ = __this_cpu_ptr(&(pcp)); \
77 switch (sizeof(*ptr__)) { \
79 ret__ = cmpxchg64(ptr__, oval, nval); \
82 ret__ = cmpxchg(ptr__, oval, nval); \
88 #define this_cpu_cmpxchg_1(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
89 #define this_cpu_cmpxchg_2(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
90 #define this_cpu_cmpxchg_4(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
91 #define this_cpu_cmpxchg_8(pcp, oval, nval) arch_this_cpu_cmpxchg(pcp, oval, nval)
93 #define arch_this_cpu_xchg(pcp, nval) \
98 ptr__ = __this_cpu_ptr(&(pcp)); \
99 ret__ = xchg(ptr__, nval); \
104 #define this_cpu_xchg_1(pcp, nval) arch_this_cpu_xchg(pcp, nval)
105 #define this_cpu_xchg_2(pcp, nval) arch_this_cpu_xchg(pcp, nval)
106 #define this_cpu_xchg_4(pcp, nval) arch_this_cpu_xchg(pcp, nval)
108 #define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval)
111 #define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \
113 typeof(pcp1) o1__ = (o1), n1__ = (n1); \
114 typeof(pcp2) o2__ = (o2), n2__ = (n2); \
115 typeof(pcp1) *p1__; \
116 typeof(pcp2) *p2__; \
119 p1__ = __this_cpu_ptr(&(pcp1)); \
120 p2__ = __this_cpu_ptr(&(pcp2)); \
121 ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__); \
126 #define this_cpu_cmpxchg_double_4 arch_this_cpu_cmpxchg_double
128 #define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double