diff options
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/bpf/jit.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c index 4054b70d7719..5afcb3c4c2ef 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c | |||
@@ -1163,7 +1163,7 @@ mem_op_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta, | |||
1163 | bool clr_gpr, lmem_step step) | 1163 | bool clr_gpr, lmem_step step) |
1164 | { | 1164 | { |
1165 | s32 off = nfp_prog->stack_frame_depth + meta->insn.off + ptr_off; | 1165 | s32 off = nfp_prog->stack_frame_depth + meta->insn.off + ptr_off; |
1166 | bool first = true, last; | 1166 | bool first = true, narrow_ld, last; |
1167 | bool needs_inc = false; | 1167 | bool needs_inc = false; |
1168 | swreg stack_off_reg; | 1168 | swreg stack_off_reg; |
1169 | u8 prev_gpr = 255; | 1169 | u8 prev_gpr = 255; |
@@ -1209,13 +1209,22 @@ mem_op_stack(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta, | |||
1209 | 1209 | ||
1210 | needs_inc = true; | 1210 | needs_inc = true; |
1211 | } | 1211 | } |
1212 | |||
1213 | narrow_ld = clr_gpr && size < 8; | ||
1214 | |||
1212 | if (lm3) { | 1215 | if (lm3) { |
1216 | unsigned int nop_cnt; | ||
1217 | |||
1213 | emit_csr_wr(nfp_prog, imm_b(nfp_prog), NFP_CSR_ACT_LM_ADDR3); | 1218 | emit_csr_wr(nfp_prog, imm_b(nfp_prog), NFP_CSR_ACT_LM_ADDR3); |
1214 | /* For size < 4 one slot will be filled by zeroing of upper. */ | 1219 | /* For size < 4 one slot will be filled by zeroing of upper, |
1215 | wrp_nops(nfp_prog, clr_gpr && size < 8 ? 2 : 3); | 1220 | * but be careful, that zeroing could be eliminated by zext |
1221 | * optimization. | ||
1222 | */ | ||
1223 | nop_cnt = narrow_ld && meta->flags & FLAG_INSN_DO_ZEXT ? 2 : 3; | ||
1224 | wrp_nops(nfp_prog, nop_cnt); | ||
1216 | } | 1225 | } |
1217 | 1226 | ||
1218 | if (clr_gpr && size < 8) | 1227 | if (narrow_ld) |
1219 | wrp_zext(nfp_prog, meta, gpr); | 1228 | wrp_zext(nfp_prog, meta, gpr); |
1220 | 1229 | ||
1221 | while (size) { | 1230 | while (size) { |