Cc: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxx> Cc: Sandipan Das <sandipan@xxxxxxxxxxxxx> Signed-off-by: Jiong Wang <jiong.wang@xxxxxxxxxxxxx> --- arch/powerpc/net/bpf_jit_comp64.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index 21a1dcd..2266c7c 100644 --- a/arch/powerpc/net/bpf_jit_comp64.c +++ b/arch/powerpc/net/bpf_jit_comp64.c @@ -557,9 +557,15 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, goto bpf_alu32_trunc; break; + /* + * ZEXT, does low 32-bit zero extension unconditionally + */ + case BPF_ALU | BPF_ZEXT: + PPC_RLWINM(dst_reg, dst_reg, 0, 0, 31); + break; bpf_alu32_trunc: /* Truncate to 32-bits */ - if (BPF_CLASS(code) == BPF_ALU) + if (BPF_CLASS(code) == BPF_ALU && !fp->aux->verifier_zext) PPC_RLWINM(dst_reg, dst_reg, 0, 0, 31); break; @@ -1046,6 +1052,11 @@ struct powerpc64_jit_data { struct codegen_context ctx; }; +bool bpf_jit_hardware_zext(void) +{ + return false; +} + struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) { u32 proglen; -- 2.7.4