diff options
Diffstat (limited to 'arch/s390/include/asm/rwsem.h')
-rw-r--r-- | arch/s390/include/asm/rwsem.h | 147 |
1 files changed, 73 insertions, 74 deletions
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h index 9d2a17971805..423fdda2322d 100644 --- a/arch/s390/include/asm/rwsem.h +++ b/arch/s390/include/asm/rwsem.h | |||
@@ -124,21 +124,21 @@ static inline void __down_read(struct rw_semaphore *sem) | |||
124 | 124 | ||
125 | asm volatile( | 125 | asm volatile( |
126 | #ifndef __s390x__ | 126 | #ifndef __s390x__ |
127 | " l %0,0(%3)\n" | 127 | " l %0,%2\n" |
128 | "0: lr %1,%0\n" | 128 | "0: lr %1,%0\n" |
129 | " ahi %1,%5\n" | 129 | " ahi %1,%4\n" |
130 | " cs %0,%1,0(%3)\n" | 130 | " cs %0,%1,%2\n" |
131 | " jl 0b" | 131 | " jl 0b" |
132 | #else /* __s390x__ */ | 132 | #else /* __s390x__ */ |
133 | " lg %0,0(%3)\n" | 133 | " lg %0,%2\n" |
134 | "0: lgr %1,%0\n" | 134 | "0: lgr %1,%0\n" |
135 | " aghi %1,%5\n" | 135 | " aghi %1,%4\n" |
136 | " csg %0,%1,0(%3)\n" | 136 | " csg %0,%1,%2\n" |
137 | " jl 0b" | 137 | " jl 0b" |
138 | #endif /* __s390x__ */ | 138 | #endif /* __s390x__ */ |
139 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 139 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
140 | : "a" (&sem->count), "m" (sem->count), | 140 | : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) |
141 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); | 141 | : "cc", "memory"); |
142 | if (old < 0) | 142 | if (old < 0) |
143 | rwsem_down_read_failed(sem); | 143 | rwsem_down_read_failed(sem); |
144 | } | 144 | } |
@@ -152,25 +152,25 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) | |||
152 | 152 | ||
153 | asm volatile( | 153 | asm volatile( |
154 | #ifndef __s390x__ | 154 | #ifndef __s390x__ |
155 | " l %0,0(%3)\n" | 155 | " l %0,%2\n" |
156 | "0: ltr %1,%0\n" | 156 | "0: ltr %1,%0\n" |
157 | " jm 1f\n" | 157 | " jm 1f\n" |
158 | " ahi %1,%5\n" | 158 | " ahi %1,%4\n" |
159 | " cs %0,%1,0(%3)\n" | 159 | " cs %0,%1,%2\n" |
160 | " jl 0b\n" | 160 | " jl 0b\n" |
161 | "1:" | 161 | "1:" |
162 | #else /* __s390x__ */ | 162 | #else /* __s390x__ */ |
163 | " lg %0,0(%3)\n" | 163 | " lg %0,%2\n" |
164 | "0: ltgr %1,%0\n" | 164 | "0: ltgr %1,%0\n" |
165 | " jm 1f\n" | 165 | " jm 1f\n" |
166 | " aghi %1,%5\n" | 166 | " aghi %1,%4\n" |
167 | " csg %0,%1,0(%3)\n" | 167 | " csg %0,%1,%2\n" |
168 | " jl 0b\n" | 168 | " jl 0b\n" |
169 | "1:" | 169 | "1:" |
170 | #endif /* __s390x__ */ | 170 | #endif /* __s390x__ */ |
171 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 171 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
172 | : "a" (&sem->count), "m" (sem->count), | 172 | : "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) |
173 | "i" (RWSEM_ACTIVE_READ_BIAS) : "cc", "memory"); | 173 | : "cc", "memory"); |
174 | return old >= 0 ? 1 : 0; | 174 | return old >= 0 ? 1 : 0; |
175 | } | 175 | } |
176 | 176 | ||
@@ -184,20 +184,20 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | |||
184 | tmp = RWSEM_ACTIVE_WRITE_BIAS; | 184 | tmp = RWSEM_ACTIVE_WRITE_BIAS; |
185 | asm volatile( | 185 | asm volatile( |
186 | #ifndef __s390x__ | 186 | #ifndef __s390x__ |
187 | " l %0,0(%3)\n" | 187 | " l %0,%2\n" |
188 | "0: lr %1,%0\n" | 188 | "0: lr %1,%0\n" |
189 | " a %1,%5\n" | 189 | " a %1,%4\n" |
190 | " cs %0,%1,0(%3)\n" | 190 | " cs %0,%1,%2\n" |
191 | " jl 0b" | 191 | " jl 0b" |
192 | #else /* __s390x__ */ | 192 | #else /* __s390x__ */ |
193 | " lg %0,0(%3)\n" | 193 | " lg %0,%2\n" |
194 | "0: lgr %1,%0\n" | 194 | "0: lgr %1,%0\n" |
195 | " ag %1,%5\n" | 195 | " ag %1,%4\n" |
196 | " csg %0,%1,0(%3)\n" | 196 | " csg %0,%1,%2\n" |
197 | " jl 0b" | 197 | " jl 0b" |
198 | #endif /* __s390x__ */ | 198 | #endif /* __s390x__ */ |
199 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 199 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
200 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 200 | : "Q" (sem->count), "m" (tmp) |
201 | : "cc", "memory"); | 201 | : "cc", "memory"); |
202 | if (old != 0) | 202 | if (old != 0) |
203 | rwsem_down_write_failed(sem); | 203 | rwsem_down_write_failed(sem); |
@@ -217,22 +217,22 @@ static inline int __down_write_trylock(struct rw_semaphore *sem) | |||
217 | 217 | ||
218 | asm volatile( | 218 | asm volatile( |
219 | #ifndef __s390x__ | 219 | #ifndef __s390x__ |
220 | " l %0,0(%2)\n" | 220 | " l %0,%1\n" |
221 | "0: ltr %0,%0\n" | 221 | "0: ltr %0,%0\n" |
222 | " jnz 1f\n" | 222 | " jnz 1f\n" |
223 | " cs %0,%4,0(%2)\n" | 223 | " cs %0,%3,%1\n" |
224 | " jl 0b\n" | 224 | " jl 0b\n" |
225 | #else /* __s390x__ */ | 225 | #else /* __s390x__ */ |
226 | " lg %0,0(%2)\n" | 226 | " lg %0,%1\n" |
227 | "0: ltgr %0,%0\n" | 227 | "0: ltgr %0,%0\n" |
228 | " jnz 1f\n" | 228 | " jnz 1f\n" |
229 | " csg %0,%4,0(%2)\n" | 229 | " csg %0,%3,%1\n" |
230 | " jl 0b\n" | 230 | " jl 0b\n" |
231 | #endif /* __s390x__ */ | 231 | #endif /* __s390x__ */ |
232 | "1:" | 232 | "1:" |
233 | : "=&d" (old), "=m" (sem->count) | 233 | : "=&d" (old), "=Q" (sem->count) |
234 | : "a" (&sem->count), "m" (sem->count), | 234 | : "Q" (sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS) |
235 | "d" (RWSEM_ACTIVE_WRITE_BIAS) : "cc", "memory"); | 235 | : "cc", "memory"); |
236 | return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; | 236 | return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; |
237 | } | 237 | } |
238 | 238 | ||
@@ -245,21 +245,20 @@ static inline void __up_read(struct rw_semaphore *sem) | |||
245 | 245 | ||
246 | asm volatile( | 246 | asm volatile( |
247 | #ifndef __s390x__ | 247 | #ifndef __s390x__ |
248 | " l %0,0(%3)\n" | 248 | " l %0,%2\n" |
249 | "0: lr %1,%0\n" | 249 | "0: lr %1,%0\n" |
250 | " ahi %1,%5\n" | 250 | " ahi %1,%4\n" |
251 | " cs %0,%1,0(%3)\n" | 251 | " cs %0,%1,%2\n" |
252 | " jl 0b" | 252 | " jl 0b" |
253 | #else /* __s390x__ */ | 253 | #else /* __s390x__ */ |
254 | " lg %0,0(%3)\n" | 254 | " lg %0,%2\n" |
255 | "0: lgr %1,%0\n" | 255 | "0: lgr %1,%0\n" |
256 | " aghi %1,%5\n" | 256 | " aghi %1,%4\n" |
257 | " csg %0,%1,0(%3)\n" | 257 | " csg %0,%1,%2\n" |
258 | " jl 0b" | 258 | " jl 0b" |
259 | #endif /* __s390x__ */ | 259 | #endif /* __s390x__ */ |
260 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 260 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
261 | : "a" (&sem->count), "m" (sem->count), | 261 | : "Q" (sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS) |
262 | "i" (-RWSEM_ACTIVE_READ_BIAS) | ||
263 | : "cc", "memory"); | 262 | : "cc", "memory"); |
264 | if (new < 0) | 263 | if (new < 0) |
265 | if ((new & RWSEM_ACTIVE_MASK) == 0) | 264 | if ((new & RWSEM_ACTIVE_MASK) == 0) |
@@ -276,20 +275,20 @@ static inline void __up_write(struct rw_semaphore *sem) | |||
276 | tmp = -RWSEM_ACTIVE_WRITE_BIAS; | 275 | tmp = -RWSEM_ACTIVE_WRITE_BIAS; |
277 | asm volatile( | 276 | asm volatile( |
278 | #ifndef __s390x__ | 277 | #ifndef __s390x__ |
279 | " l %0,0(%3)\n" | 278 | " l %0,%2\n" |
280 | "0: lr %1,%0\n" | 279 | "0: lr %1,%0\n" |
281 | " a %1,%5\n" | 280 | " a %1,%4\n" |
282 | " cs %0,%1,0(%3)\n" | 281 | " cs %0,%1,%2\n" |
283 | " jl 0b" | 282 | " jl 0b" |
284 | #else /* __s390x__ */ | 283 | #else /* __s390x__ */ |
285 | " lg %0,0(%3)\n" | 284 | " lg %0,%2\n" |
286 | "0: lgr %1,%0\n" | 285 | "0: lgr %1,%0\n" |
287 | " ag %1,%5\n" | 286 | " ag %1,%4\n" |
288 | " csg %0,%1,0(%3)\n" | 287 | " csg %0,%1,%2\n" |
289 | " jl 0b" | 288 | " jl 0b" |
290 | #endif /* __s390x__ */ | 289 | #endif /* __s390x__ */ |
291 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 290 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
292 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 291 | : "Q" (sem->count), "m" (tmp) |
293 | : "cc", "memory"); | 292 | : "cc", "memory"); |
294 | if (new < 0) | 293 | if (new < 0) |
295 | if ((new & RWSEM_ACTIVE_MASK) == 0) | 294 | if ((new & RWSEM_ACTIVE_MASK) == 0) |
@@ -306,20 +305,20 @@ static inline void __downgrade_write(struct rw_semaphore *sem) | |||
306 | tmp = -RWSEM_WAITING_BIAS; | 305 | tmp = -RWSEM_WAITING_BIAS; |
307 | asm volatile( | 306 | asm volatile( |
308 | #ifndef __s390x__ | 307 | #ifndef __s390x__ |
309 | " l %0,0(%3)\n" | 308 | " l %0,%2\n" |
310 | "0: lr %1,%0\n" | 309 | "0: lr %1,%0\n" |
311 | " a %1,%5\n" | 310 | " a %1,%4\n" |
312 | " cs %0,%1,0(%3)\n" | 311 | " cs %0,%1,%2\n" |
313 | " jl 0b" | 312 | " jl 0b" |
314 | #else /* __s390x__ */ | 313 | #else /* __s390x__ */ |
315 | " lg %0,0(%3)\n" | 314 | " lg %0,%2\n" |
316 | "0: lgr %1,%0\n" | 315 | "0: lgr %1,%0\n" |
317 | " ag %1,%5\n" | 316 | " ag %1,%4\n" |
318 | " csg %0,%1,0(%3)\n" | 317 | " csg %0,%1,%2\n" |
319 | " jl 0b" | 318 | " jl 0b" |
320 | #endif /* __s390x__ */ | 319 | #endif /* __s390x__ */ |
321 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 320 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
322 | : "a" (&sem->count), "m" (sem->count), "m" (tmp) | 321 | : "Q" (sem->count), "m" (tmp) |
323 | : "cc", "memory"); | 322 | : "cc", "memory"); |
324 | if (new > 1) | 323 | if (new > 1) |
325 | rwsem_downgrade_wake(sem); | 324 | rwsem_downgrade_wake(sem); |
@@ -334,20 +333,20 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) | |||
334 | 333 | ||
335 | asm volatile( | 334 | asm volatile( |
336 | #ifndef __s390x__ | 335 | #ifndef __s390x__ |
337 | " l %0,0(%3)\n" | 336 | " l %0,%2\n" |
338 | "0: lr %1,%0\n" | 337 | "0: lr %1,%0\n" |
339 | " ar %1,%5\n" | 338 | " ar %1,%4\n" |
340 | " cs %0,%1,0(%3)\n" | 339 | " cs %0,%1,%2\n" |
341 | " jl 0b" | 340 | " jl 0b" |
342 | #else /* __s390x__ */ | 341 | #else /* __s390x__ */ |
343 | " lg %0,0(%3)\n" | 342 | " lg %0,%2\n" |
344 | "0: lgr %1,%0\n" | 343 | "0: lgr %1,%0\n" |
345 | " agr %1,%5\n" | 344 | " agr %1,%4\n" |
346 | " csg %0,%1,0(%3)\n" | 345 | " csg %0,%1,%2\n" |
347 | " jl 0b" | 346 | " jl 0b" |
348 | #endif /* __s390x__ */ | 347 | #endif /* __s390x__ */ |
349 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 348 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
350 | : "a" (&sem->count), "m" (sem->count), "d" (delta) | 349 | : "Q" (sem->count), "d" (delta) |
351 | : "cc", "memory"); | 350 | : "cc", "memory"); |
352 | } | 351 | } |
353 | 352 | ||
@@ -360,20 +359,20 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) | |||
360 | 359 | ||
361 | asm volatile( | 360 | asm volatile( |
362 | #ifndef __s390x__ | 361 | #ifndef __s390x__ |
363 | " l %0,0(%3)\n" | 362 | " l %0,%2\n" |
364 | "0: lr %1,%0\n" | 363 | "0: lr %1,%0\n" |
365 | " ar %1,%5\n" | 364 | " ar %1,%4\n" |
366 | " cs %0,%1,0(%3)\n" | 365 | " cs %0,%1,%2\n" |
367 | " jl 0b" | 366 | " jl 0b" |
368 | #else /* __s390x__ */ | 367 | #else /* __s390x__ */ |
369 | " lg %0,0(%3)\n" | 368 | " lg %0,%2\n" |
370 | "0: lgr %1,%0\n" | 369 | "0: lgr %1,%0\n" |
371 | " agr %1,%5\n" | 370 | " agr %1,%4\n" |
372 | " csg %0,%1,0(%3)\n" | 371 | " csg %0,%1,%2\n" |
373 | " jl 0b" | 372 | " jl 0b" |
374 | #endif /* __s390x__ */ | 373 | #endif /* __s390x__ */ |
375 | : "=&d" (old), "=&d" (new), "=m" (sem->count) | 374 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
376 | : "a" (&sem->count), "m" (sem->count), "d" (delta) | 375 | : "Q" (sem->count), "d" (delta) |
377 | : "cc", "memory"); | 376 | : "cc", "memory"); |
378 | return new; | 377 | return new; |
379 | } | 378 | } |