Skip to content

Commit eb5a33e

Browse files
chleroympe
authored andcommitted
powerpc: Don't hide eh field of lwarx behind a macro
The eh field must remain 0 for PPC32 and is only used by PPC64. Don't hide that behind a macro, just leave the responsibility to the user. At the time being, the only users of PPC_RAW_L{WDQ}ARX are setting the eh field to 0, so the special handling of __PPC_EH is useless. Just take the value given by the caller. Same for DEFINE_TESTOP(), don't do special handling in that macro, ensure the caller hands over the proper eh value. Signed-off-by: Christophe Leroy <[email protected]> [mpe: Use 'n' constraint per Segher] Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/8b9c8a1a14f9143552a85fcbf96698224a8c2469.1659430931.git.christophe.leroy@csgroup.eu
1 parent 18db466 commit eb5a33e

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

arch/powerpc/include/asm/bitops.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ static inline unsigned long fn( \
163163
"bne- 1b\n" \
164164
postfix \
165165
: "=&r" (old), "=&r" (t) \
166-
: "rK" (mask), "r" (p), "i" (IS_ENABLED(CONFIG_PPC64) ? eh : 0) \
166+
: "rK" (mask), "r" (p), "n" (eh) \
167167
: "cc", "memory"); \
168168
return (old & mask); \
169169
}
170170

171171
DEFINE_TESTOP(test_and_set_bits, or, PPC_ATOMIC_ENTRY_BARRIER,
172172
PPC_ATOMIC_EXIT_BARRIER, 0)
173173
DEFINE_TESTOP(test_and_set_bits_lock, or, "",
174-
PPC_ACQUIRE_BARRIER, 1)
174+
PPC_ACQUIRE_BARRIER, IS_ENABLED(CONFIG_PPC64))
175175
DEFINE_TESTOP(test_and_change_bits, xor, PPC_ATOMIC_ENTRY_BARRIER,
176176
PPC_ATOMIC_EXIT_BARRIER, 0)
177177

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@
343343
#define __PPC_SPR(r) ((((r) & 0x1f) << 16) | ((((r) >> 5) & 0x1f) << 11))
344344
#define __PPC_RC21 (0x1 << 10)
345345
#define __PPC_PRFX_R(r) (((r) & 0x1) << 20)
346+
#define __PPC_EH(eh) (((eh) & 0x1) << 0)
346347

347348
/*
348349
* Both low and high 16 bits are added as SIGNED additions, so if low 16 bits
@@ -359,16 +360,6 @@
359360
#define PPC_LI_MASK 0x03fffffc
360361
#define PPC_LI(v) ((v) & PPC_LI_MASK)
361362

362-
/*
363-
* Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a
364-
* larx with EH set as an illegal instruction.
365-
*/
366-
#ifdef CONFIG_PPC64
367-
#define __PPC_EH(eh) (((eh) & 0x1) << 0)
368-
#else
369-
#define __PPC_EH(eh) 0
370-
#endif
371-
372363
/* Base instruction encoding */
373364
#define PPC_RAW_CP_ABORT (0x7c00068c)
374365
#define PPC_RAW_COPY(a, b) (PPC_INST_COPY | ___PPC_RA(a) | ___PPC_RB(b))

0 commit comments

Comments
 (0)