Skip to content

Commit 9401f4e

Browse files
chleroympe
authored andcommitted
powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros
Force the eh flag at 0 on PPC32. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/1fc81f07cabebb875b963e295408cc3dd38c8d85.1614674882.git.christophe.leroy@csgroup.eu
1 parent 19e932e commit 9401f4e

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

arch/powerpc/include/asm/asm-compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define PPC_LONG stringify_in_c(.8byte)
1818
#define PPC_LONG_ALIGN stringify_in_c(.balign 8)
1919
#define PPC_TLNEI stringify_in_c(tdnei)
20-
#define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
20+
#define PPC_LLARX stringify_in_c(ldarx)
2121
#define PPC_STLCX stringify_in_c(stdcx.)
2222
#define PPC_CNTLZL stringify_in_c(cntlzd)
2323
#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), RS)
@@ -50,7 +50,7 @@
5050
#define PPC_LONG stringify_in_c(.long)
5151
#define PPC_LONG_ALIGN stringify_in_c(.balign 4)
5252
#define PPC_TLNEI stringify_in_c(twnei)
53-
#define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
53+
#define PPC_LLARX stringify_in_c(lwarx)
5454
#define PPC_STLCX stringify_in_c(stwcx.)
5555
#define PPC_CNTLZL stringify_in_c(cntlzw)
5656
#define PPC_MTOCRF stringify_in_c(mtcrf)

arch/powerpc/include/asm/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ arch_atomic_try_cmpxchg_lock(atomic_t *v, int *old, int new)
207207
int r, o = *old;
208208

209209
__asm__ __volatile__ (
210-
"1:\t" PPC_LWARX(%0,0,%2,1) " # atomic_try_cmpxchg_acquire \n"
210+
"1: lwarx %0,0,%2,%5 # atomic_try_cmpxchg_acquire \n"
211211
" cmpw 0,%0,%3 \n"
212212
" bne- 2f \n"
213213
" stwcx. %4,0,%2 \n"
214214
" bne- 1b \n"
215215
"\t" PPC_ACQUIRE_BARRIER " \n"
216216
"2: \n"
217217
: "=&r" (r), "+m" (v->counter)
218-
: "r" (&v->counter), "r" (o), "r" (new)
218+
: "r" (&v->counter), "r" (o), "r" (new), "i" (IS_ENABLED(CONFIG_PPC64) ? 1 : 0)
219219
: "cr0", "memory");
220220

221221
if (unlikely(r != o))

arch/powerpc/include/asm/bitops.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static inline void fn(unsigned long mask, \
7070
unsigned long *p = (unsigned long *)_p; \
7171
__asm__ __volatile__ ( \
7272
prefix \
73-
"1:" PPC_LLARX(%0,0,%3,0) "\n" \
73+
"1:" PPC_LLARX "%0,0,%3,0\n" \
7474
stringify_in_c(op) "%0,%0,%2\n" \
7575
PPC_STLCX "%0,0,%3\n" \
7676
"bne- 1b\n" \
@@ -115,13 +115,13 @@ static inline unsigned long fn( \
115115
unsigned long *p = (unsigned long *)_p; \
116116
__asm__ __volatile__ ( \
117117
prefix \
118-
"1:" PPC_LLARX(%0,0,%3,eh) "\n" \
118+
"1:" PPC_LLARX "%0,0,%3,%4\n" \
119119
stringify_in_c(op) "%1,%0,%2\n" \
120120
PPC_STLCX "%1,0,%3\n" \
121121
"bne- 1b\n" \
122122
postfix \
123123
: "=&r" (old), "=&r" (t) \
124-
: "r" (mask), "r" (p) \
124+
: "r" (mask), "r" (p), "i" (IS_ENABLED(CONFIG_PPC64) ? eh : 0) \
125125
: "cc", "memory"); \
126126
return (old & mask); \
127127
}
@@ -170,7 +170,7 @@ clear_bit_unlock_return_word(int nr, volatile unsigned long *addr)
170170

171171
__asm__ __volatile__ (
172172
PPC_RELEASE_BARRIER
173-
"1:" PPC_LLARX(%0,0,%3,0) "\n"
173+
"1:" PPC_LLARX "%0,0,%3,0\n"
174174
"andc %1,%0,%2\n"
175175
PPC_STLCX "%1,0,%3\n"
176176
"bne- 1b\n"

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,6 @@
576576
#define PPC_DIVDE(t, a, b) stringify_in_c(.long PPC_RAW_DIVDE(t, a, b))
577577
#define PPC_DIVDEU(t, a, b) stringify_in_c(.long PPC_RAW_DIVDEU(t, a, b))
578578
#define PPC_LQARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LQARX(t, a, b, eh))
579-
#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LDARX(t, a, b, eh))
580-
#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LWARX(t, a, b, eh))
581579
#define PPC_STQCX(t, a, b) stringify_in_c(.long PPC_RAW_STQCX(t, a, b))
582580
#define PPC_MADDHD(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHD(t, a, b, c))
583581
#define PPC_MADDHDU(t, a, b, c) stringify_in_c(.long PPC_RAW_MADDHDU(t, a, b, c))

arch/powerpc/include/asm/simple_spinlock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock)
5151

5252
token = LOCK_TOKEN;
5353
__asm__ __volatile__(
54-
"1: " PPC_LWARX(%0,0,%2,1) "\n\
54+
"1: lwarx %0,0,%2,1\n\
5555
cmpwi 0,%0,0\n\
5656
bne- 2f\n\
5757
stwcx. %1,0,%2\n\
@@ -179,7 +179,7 @@ static inline long __arch_read_trylock(arch_rwlock_t *rw)
179179
long tmp;
180180

181181
__asm__ __volatile__(
182-
"1: " PPC_LWARX(%0,0,%1,1) "\n"
182+
"1: lwarx %0,0,%1,1\n"
183183
__DO_SIGN_EXTEND
184184
" addic. %0,%0,1\n\
185185
ble- 2f\n"
@@ -203,7 +203,7 @@ static inline long __arch_write_trylock(arch_rwlock_t *rw)
203203

204204
token = WRLOCK_TOKEN;
205205
__asm__ __volatile__(
206-
"1: " PPC_LWARX(%0,0,%2,1) "\n\
206+
"1: lwarx %0,0,%2,1\n\
207207
cmpwi 0,%0,0\n\
208208
bne- 2f\n"
209209
" stwcx. %1,0,%2\n\

0 commit comments

Comments
 (0)