[RFC PATCH 1/3] LoongArch: BPF: Add support for instructions array

From: Tiezhu Yang

Date: Wed Nov 11 2026 - 04:55:55 EST


Add support for the instructions array map type in the LoongArch
JIT by calling bpf_prog_update_insn_ptrs() with the offsets that
map xlated_offset to the jited_offset in the final image.

LoongArch JIT already has this offset array which was being used
for bpf_prog_fill_jited_linfo() and can be used directly for the
function bpf_prog_update_insn_ptrs().

This is similar to commit 84b1c40d5b4d ("bpf: arm64: Add support
for instructions array").

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
arch/loongarch/net/bpf_jit.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/loongarch/net/bpf_jit.c b/arch/loongarch/net/bpf_jit.c
index d7ea515045ec..26904010d9b5 100644
--- a/arch/loongarch/net/bpf_jit.c
+++ b/arch/loongarch/net/bpf_jit.c
@@ -2393,6 +2393,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
for (i = 0; i <= prog->len; i++)
ctx.offset[i] *= LOONGARCH_INSN_SIZE;
bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
+ bpf_prog_update_insn_ptrs(prog, ctx.offset, ctx.ro_image);

out_offset:
kvfree(ctx.offset);
--
2.42.0