diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 83da3a00db7e..b6224da9f6e8 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c @@ -1005,6 +1005,17 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, (jit->prg - patch_brc) >> 1; break; } + if (insn_is_mov_percpu_addr(insn)) { + const u64 *percpu_offset = &get_lowcore()->percpu_offset; + + if (dst_reg != src_reg) + /* lgr %dst,%src */ + EMIT4(0xb9040000, dst_reg, src_reg); + /* ag %dst,percpu_offset */ + EMIT6_DISP_LH(0xe3000000, 0x0008, dst_reg, REG_0, REG_0, + (unsigned long)percpu_offset); + break; + } switch (insn->off) { case 0: /* DST = SRC */ /* lgr %dst,%src */ @@ -3114,6 +3125,11 @@ bool bpf_jit_supports_timed_may_goto(void) return true; } +bool bpf_jit_supports_percpu_insn(void) +{ + return true; +} + bool bpf_jit_inlines_helper_call(s32 imm) { switch (imm) {