Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Neuling and committed by
Benjamin Herrenschmidt
cdaade71 55a5db18

+57 -57
+6 -6
arch/powerpc/include/asm/ppc-opcode.h
··· 180 180 #define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \ 181 181 __PPC_RA(a) | __PPC_RB(b)) 182 182 #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)) 185 185 #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)) 188 188 #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ 189 - __PPC_RB(b)) 189 + ___PPC_RB(b)) 190 190 #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ 191 191 __PPC_RA(a) | __PPC_RS(s)) 192 192 #define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \ ··· 204 204 #define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \ 205 205 __PPC_WC(w)) 206 206 #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)) 208 208 #define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \ 209 209 __PPC_RA(a) | __PPC_RB(b)) 210 210 #define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \
+51 -51
arch/powerpc/net/bpf_jit.h
··· 75 75 #define PPC_NOP() EMIT(PPC_INST_NOP) 76 76 #define PPC_BLR() EMIT(PPC_INST_BLR) 77 77 #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)) 81 81 #define PPC_MR(d, a) PPC_OR(d, a, a) 82 82 #define PPC_LI(r, i) PPC_ADDI(r, 0, i) 83 83 #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)) 85 85 #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)) 86 + #define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \ 87 + ___PPC_RA(base) | ((i) & 0xfffc)) 88 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)) 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)) 95 95 /* Convenience helpers for the above with 'far' offsets: */ 96 96 #define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \ 97 97 else { PPC_ADDIS(r, base, IMM_HA(i)); \ ··· 105 105 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 106 106 PPC_LHZ(r, r, IMM_L(i)); } } while(0) 107 107 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)) 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 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)) 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)) 141 141 /* 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) | \ 144 144 __PPC_MB(0) | __PPC_ME(31-(i))) 145 145 /* 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)) | \ 148 148 __PPC_MB(i) | __PPC_ME(31)) 149 149 /* 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) | \ 152 152 __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)) 154 154 155 155 /* Long jump; (unconditional 'branch') */ 156 156 #define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \