Skip to content

Commit cdaade7

Browse files
mikeyozbenh
authored andcommitted
powerpc: Start using ___PPC_RA/B/S/T where necessary
Now have ___PPC_RA/B/S/T we can use it in some places. These are places where we can't use the existing defines which will soon enforce R0-R31 usage. The macros being changed here are being used in inline asm, which can't convert to enforce the R0-R31 usage. bpf_jit uses a mix of both generated and non-generated with the same code, so just convert all these to use the ___PPC_R versions which won't enforce R usage later. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 55a5db1 commit cdaade7

2 files changed

Lines changed: 59 additions & 59 deletions

File tree

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@
180180
#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \
181181
__PPC_RA(a) | __PPC_RB(b))
182182
#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \
183-
__PPC_RT(t) | __PPC_RA(a) | \
184-
__PPC_RB(b) | __PPC_EH(eh))
183+
___PPC_RT(t) | ___PPC_RA(a) | \
184+
___PPC_RB(b) | __PPC_EH(eh))
185185
#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \
186-
__PPC_RT(t) | __PPC_RA(a) | \
187-
__PPC_RB(b) | __PPC_EH(eh))
186+
___PPC_RT(t) | ___PPC_RA(a) | \
187+
___PPC_RB(b) | __PPC_EH(eh))
188188
#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
189-
__PPC_RB(b))
189+
___PPC_RB(b))
190190
#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
191191
__PPC_RA(a) | __PPC_RS(s))
192192
#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
@@ -204,7 +204,7 @@
204204
#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \
205205
__PPC_WC(w))
206206
#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \
207-
__PPC_RB(a) | __PPC_RS(lp))
207+
___PPC_RB(a) | ___PPC_RS(lp))
208208
#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \
209209
__PPC_RA(a) | __PPC_RB(b))
210210
#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \

‎arch/powerpc/net/bpf_jit.h‎

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,23 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
7575
#define PPC_NOP() EMIT(PPC_INST_NOP)
7676
#define PPC_BLR() EMIT(PPC_INST_BLR)
7777
#define PPC_BLRL() EMIT(PPC_INST_BLRL)
78-
#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | __PPC_RT(r))
79-
#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | __PPC_RT(d) | \
80-
__PPC_RA(a) | IMM_L(i))
78+
#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | ___PPC_RT(r))
79+
#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | ___PPC_RT(d) | \
80+
___PPC_RA(a) | IMM_L(i))
8181
#define PPC_MR(d, a) PPC_OR(d, a, a)
8282
#define PPC_LI(r, i) PPC_ADDI(r, 0, i)
8383
#define PPC_ADDIS(d, a, i) EMIT(PPC_INST_ADDIS | \
84-
__PPC_RS(d) | __PPC_RA(a) | IMM_L(i))
84+
___PPC_RS(d) | ___PPC_RA(a) | IMM_L(i))
8585
#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i)
86-
#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | __PPC_RS(r) | \
87-
__PPC_RA(base) | ((i) & 0xfffc))
88-
89-
#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | __PPC_RT(r) | \
90-
__PPC_RA(base) | IMM_L(i))
91-
#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | __PPC_RT(r) | \
92-
__PPC_RA(base) | IMM_L(i))
93-
#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | __PPC_RT(r) | \
94-
__PPC_RA(base) | IMM_L(i))
86+
#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \
87+
___PPC_RA(base) | ((i) & 0xfffc))
88+
89+
#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \
90+
___PPC_RA(base) | IMM_L(i))
91+
#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | ___PPC_RT(r) | \
92+
___PPC_RA(base) | IMM_L(i))
93+
#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
94+
___PPC_RA(base) | IMM_L(i))
9595
/* Convenience helpers for the above with 'far' offsets: */
9696
#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \
9797
else { PPC_ADDIS(r, base, IMM_HA(i)); \
@@ -105,52 +105,52 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
105105
else { PPC_ADDIS(r, base, IMM_HA(i)); \
106106
PPC_LHZ(r, r, IMM_L(i)); } } while(0)
107107

108-
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | __PPC_RA(a) | IMM_L(i))
109-
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | __PPC_RA(a) | IMM_L(i))
110-
#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | __PPC_RA(a) | IMM_L(i))
111-
#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | __PPC_RA(a) | __PPC_RB(b))
112-
113-
#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | __PPC_RT(d) | \
114-
__PPC_RB(a) | __PPC_RA(b))
115-
#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | __PPC_RT(d) | \
116-
__PPC_RA(a) | __PPC_RB(b))
117-
#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | __PPC_RT(d) | \
118-
__PPC_RA(a) | __PPC_RB(b))
119-
#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | __PPC_RT(d) | \
120-
__PPC_RA(a) | __PPC_RB(b))
121-
#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | __PPC_RT(d) | \
122-
__PPC_RA(a) | IMM_L(i))
123-
#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | __PPC_RT(d) | \
124-
__PPC_RA(a) | __PPC_RB(b))
125-
#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | __PPC_RA(d) | \
126-
__PPC_RS(a) | __PPC_RB(b))
127-
#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | __PPC_RA(d) | \
128-
__PPC_RS(a) | IMM_L(i))
129-
#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | __PPC_RA(d) | \
130-
__PPC_RS(a) | __PPC_RB(b))
131-
#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | __PPC_RA(d) | \
132-
__PPC_RS(a) | __PPC_RB(b))
133-
#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | __PPC_RA(d) | \
134-
__PPC_RS(a) | IMM_L(i))
135-
#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | __PPC_RA(d) | \
136-
__PPC_RS(a) | IMM_L(i))
137-
#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | __PPC_RA(d) | \
138-
__PPC_RS(a) | __PPC_RB(s))
139-
#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | __PPC_RA(d) | \
140-
__PPC_RS(a) | __PPC_RB(s))
108+
#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
109+
#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
110+
#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))
111+
#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | ___PPC_RA(a) | ___PPC_RB(b))
112+
113+
#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | ___PPC_RT(d) | \
114+
___PPC_RB(a) | ___PPC_RA(b))
115+
#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | ___PPC_RT(d) | \
116+
___PPC_RA(a) | ___PPC_RB(b))
117+
#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | ___PPC_RT(d) | \
118+
___PPC_RA(a) | ___PPC_RB(b))
119+
#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | ___PPC_RT(d) | \
120+
___PPC_RA(a) | ___PPC_RB(b))
121+
#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | ___PPC_RT(d) | \
122+
___PPC_RA(a) | IMM_L(i))
123+
#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | ___PPC_RT(d) | \
124+
___PPC_RA(a) | ___PPC_RB(b))
125+
#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | ___PPC_RA(d) | \
126+
___PPC_RS(a) | ___PPC_RB(b))
127+
#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | ___PPC_RA(d) | \
128+
___PPC_RS(a) | IMM_L(i))
129+
#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | ___PPC_RA(d) | \
130+
___PPC_RS(a) | ___PPC_RB(b))
131+
#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | ___PPC_RA(d) | \
132+
___PPC_RS(a) | ___PPC_RB(b))
133+
#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | ___PPC_RA(d) | \
134+
___PPC_RS(a) | IMM_L(i))
135+
#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \
136+
___PPC_RS(a) | IMM_L(i))
137+
#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \
138+
___PPC_RS(a) | ___PPC_RB(s))
139+
#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \
140+
___PPC_RS(a) | ___PPC_RB(s))
141141
/* slwi = rlwinm Rx, Ry, n, 0, 31-n */
142-
#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \
143-
__PPC_RS(a) | __PPC_SH(i) | \
142+
#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
143+
___PPC_RS(a) | __PPC_SH(i) | \
144144
__PPC_MB(0) | __PPC_ME(31-(i)))
145145
/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */
146-
#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \
147-
__PPC_RS(a) | __PPC_SH(32-(i)) | \
146+
#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
147+
___PPC_RS(a) | __PPC_SH(32-(i)) | \
148148
__PPC_MB(i) | __PPC_ME(31))
149149
/* sldi = rldicr Rx, Ry, n, 63-n */
150-
#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | __PPC_RA(d) | \
151-
__PPC_RS(a) | __PPC_SH(i) | \
150+
#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | ___PPC_RA(d) | \
151+
___PPC_RS(a) | __PPC_SH(i) | \
152152
__PPC_MB(63-(i)) | (((i) & 0x20) >> 4))
153-
#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | __PPC_RT(d) | __PPC_RA(a))
153+
#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))
154154

155155
/* Long jump; (unconditional 'branch') */
156156
#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \

0 commit comments

Comments
 (0)