diff options
Diffstat (limited to 'arch/s390/include/asm/percpu.h')
-rw-r--r-- | arch/s390/include/asm/percpu.h | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/arch/s390/include/asm/percpu.h b/arch/s390/include/asm/percpu.h index 6537e72e0853..86fe0ee2cee5 100644 --- a/arch/s390/include/asm/percpu.h +++ b/arch/s390/include/asm/percpu.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #define arch_this_cpu_to_op(pcp, val, op) \ | 22 | #define arch_this_cpu_to_op(pcp, val, op) \ |
23 | do { \ | 23 | ({ \ |
24 | typedef typeof(pcp) pcp_op_T__; \ | 24 | typedef typeof(pcp) pcp_op_T__; \ |
25 | pcp_op_T__ old__, new__, prev__; \ | 25 | pcp_op_T__ old__, new__, prev__; \ |
26 | pcp_op_T__ *ptr__; \ | 26 | pcp_op_T__ *ptr__; \ |
@@ -39,13 +39,19 @@ do { \ | |||
39 | } \ | 39 | } \ |
40 | } while (prev__ != old__); \ | 40 | } while (prev__ != old__); \ |
41 | preempt_enable(); \ | 41 | preempt_enable(); \ |
42 | } while (0) | 42 | new__; \ |
43 | }) | ||
43 | 44 | ||
44 | #define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +) | 45 | #define this_cpu_add_1(pcp, val) arch_this_cpu_to_op(pcp, val, +) |
45 | #define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +) | 46 | #define this_cpu_add_2(pcp, val) arch_this_cpu_to_op(pcp, val, +) |
46 | #define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +) | 47 | #define this_cpu_add_4(pcp, val) arch_this_cpu_to_op(pcp, val, +) |
47 | #define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +) | 48 | #define this_cpu_add_8(pcp, val) arch_this_cpu_to_op(pcp, val, +) |
48 | 49 | ||
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, +) | ||
54 | |||
49 | #define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &) | 55 | #define this_cpu_and_1(pcp, val) arch_this_cpu_to_op(pcp, val, &) |
50 | #define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &) | 56 | #define this_cpu_and_2(pcp, val) arch_this_cpu_to_op(pcp, val, &) |
51 | #define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &) | 57 | #define this_cpu_and_4(pcp, val) arch_this_cpu_to_op(pcp, val, &) |
@@ -61,7 +67,7 @@ do { \ | |||
61 | #define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^) | 67 | #define this_cpu_xor_4(pcp, val) arch_this_cpu_to_op(pcp, val, ^) |
62 | #define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^) | 68 | #define this_cpu_xor_8(pcp, val) arch_this_cpu_to_op(pcp, val, ^) |
63 | 69 | ||
64 | #define arch_this_cpu_cmpxchg(pcp, oval, nval) \ | 70 | #define arch_this_cpu_cmpxchg(pcp, oval, nval) \ |
65 | ({ \ | 71 | ({ \ |
66 | typedef typeof(pcp) pcp_op_T__; \ | 72 | typedef typeof(pcp) pcp_op_T__; \ |
67 | pcp_op_T__ ret__; \ | 73 | pcp_op_T__ ret__; \ |
@@ -84,6 +90,44 @@ do { \ | |||
84 | #define this_cpu_cmpxchg_4(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) |
85 | #define this_cpu_cmpxchg_8(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) |
86 | 92 | ||
93 | #define arch_this_cpu_xchg(pcp, nval) \ | ||
94 | ({ \ | ||
95 | typeof(pcp) *ptr__; \ | ||
96 | typeof(pcp) ret__; \ | ||
97 | preempt_disable(); \ | ||
98 | ptr__ = __this_cpu_ptr(&(pcp)); \ | ||
99 | ret__ = xchg(ptr__, nval); \ | ||
100 | preempt_enable(); \ | ||
101 | ret__; \ | ||
102 | }) | ||
103 | |||
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) | ||
107 | #ifdef CONFIG_64BIT | ||
108 | #define this_cpu_xchg_8(pcp, nval) arch_this_cpu_xchg(pcp, nval) | ||
109 | #endif | ||
110 | |||
111 | #define arch_this_cpu_cmpxchg_double(pcp1, pcp2, o1, o2, n1, n2) \ | ||
112 | ({ \ | ||
113 | typeof(pcp1) o1__ = (o1), n1__ = (n1); \ | ||
114 | typeof(pcp2) o2__ = (o2), n2__ = (n2); \ | ||
115 | typeof(pcp1) *p1__; \ | ||
116 | typeof(pcp2) *p2__; \ | ||
117 | int ret__; \ | ||
118 | preempt_disable(); \ | ||
119 | p1__ = __this_cpu_ptr(&(pcp1)); \ | ||
120 | p2__ = __this_cpu_ptr(&(pcp2)); \ | ||
121 | ret__ = __cmpxchg_double(p1__, p2__, o1__, o2__, n1__, n2__); \ | ||
122 | preempt_enable(); \ | ||
123 | ret__; \ | ||
124 | }) | ||
125 | |||
126 | #define this_cpu_cmpxchg_double_4 arch_this_cpu_cmpxchg_double | ||
127 | #ifdef CONFIG_64BIT | ||
128 | #define this_cpu_cmpxchg_double_8 arch_this_cpu_cmpxchg_double | ||
129 | #endif | ||
130 | |||
87 | #include <asm-generic/percpu.h> | 131 | #include <asm-generic/percpu.h> |
88 | 132 | ||
89 | #endif /* __ARCH_S390_PERCPU__ */ | 133 | #endif /* __ARCH_S390_PERCPU__ */ |