Re: [PATCH bpf-next 1/3] bpf,s390: introduce emit_store_stack_imm64() for trampoline

From: Menglong Dong

Date: Mon Feb 23 2026 - 21:48:59 EST


On 2026/2/23 19:44 Ilya Leoshkevich <iii@xxxxxxxxxxxxx> write:
>
> On 2/23/26 09:40, Menglong Dong wrote:
> > Introduce a helper to store 64-bit immediate on the trampoline stack with
> > a help of a register.
> >
> > Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx>
> > ---
> > arch/s390/net/bpf_jit_comp.c | 27 +++++++++++----------------
> > 1 file changed, 11 insertions(+), 16 deletions(-)
>
> [...]
>
> > @@ -2743,18 +2747,9 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,
> > * arg_cnt = m->nr_args;
> > */
> >
> > - if (flags & BPF_TRAMP_F_IP_ARG) {
> > - /* %r0 = func_addr */
> > - load_imm64(jit, REG_0, (u64)func_addr);
> > - /* stg %r0,ip_off(%r15) */
> > - EMIT6_DISP_LH(0xe3000000, 0x0024, REG_0, REG_0, REG_15,
> > - tjit->ip_off);
> > - }
> > - /* lghi %r0,nr_bpf_args */
> > - EMIT4_IMM(0xa7090000, REG_0, nr_bpf_args);
>
> LGHI is more space-efficient than load_imm64(), can we keep it open-coded?

OK, I can keep this lghi instruction as it was.

Thanks for your reviewing :)

>
> With this changed:
>
> Reviewed-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
>
>
>