summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
authorJohan Almbladh <johan.almbladh@anyfinetworks.com>2026-09-26 01:19:32 +0200
committerAlexei Starovoitov <ast@kernel.org>2026-09-26 07:41:21 +0000
commitf4f496decae188ab1621023fecb3d2c191e6e43a (patch)
treeeefcee09255441c300ee3ea13ff3c92f0ec6892d /arch/mips
parent89d8e19811f2b18c273fe4056d193e82afaa6e1a (diff)
bpf, mips: Add JIT support for JMP32_JA
The JMP32_JA instruction from the eBPF v4 ISA was not implemented. This caused programs using the instruction to fall back to the interpreter. Implement the JMP32_JA instruction. Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20260925231932.1063678-3-johan.almbladh@anyfinetworks.com
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/net/bpf_jit_comp.c2
-rw-r--r--arch/mips/net/bpf_jit_comp.h2
-rw-r--r--arch/mips/net/bpf_jit_comp32.c7
-rw-r--r--arch/mips/net/bpf_jit_comp64.c7
4 files changed, 16 insertions, 2 deletions
diff --git a/arch/mips/net/bpf_jit_comp.c b/arch/mips/net/bpf_jit_comp.c
index f14de6d73122..4682dbb3a059 100644
--- a/arch/mips/net/bpf_jit_comp.c
+++ b/arch/mips/net/bpf_jit_comp.c
@@ -850,7 +850,7 @@ void emit_jmp_r(struct jit_context *ctx, u8 dst, u8 src, s32 off, u8 op)
}
/* Jump always */
-int emit_ja(struct jit_context *ctx, s16 off)
+int emit_ja(struct jit_context *ctx, s32 off)
{
int target = get_target(ctx, ctx->bpf_index + off + 1);
diff --git a/arch/mips/net/bpf_jit_comp.h b/arch/mips/net/bpf_jit_comp.h
index 0ddedb733dd1..d0ab5c9a0c46 100644
--- a/arch/mips/net/bpf_jit_comp.h
+++ b/arch/mips/net/bpf_jit_comp.h
@@ -204,7 +204,7 @@ void emit_jmp_i(struct jit_context *ctx, u8 dst, s32 imm, s32 off, u8 op);
void emit_jmp_r(struct jit_context *ctx, u8 dst, u8 src, s32 off, u8 op);
/* Jump always */
-int emit_ja(struct jit_context *ctx, s16 off);
+int emit_ja(struct jit_context *ctx, s32 off);
/* Jump to epilogue */
int emit_exit(struct jit_context *ctx);
diff --git a/arch/mips/net/bpf_jit_comp32.c b/arch/mips/net/bpf_jit_comp32.c
index 158e69718c09..84d9c7036e4f 100644
--- a/arch/mips/net/bpf_jit_comp32.c
+++ b/arch/mips/net/bpf_jit_comp32.c
@@ -1877,6 +1877,13 @@ int build_insn(const struct bpf_insn *insn, struct jit_context *ctx)
if (finish_jmp(ctx, jmp, off) < 0)
goto toofar;
break;
+ /* PC += imm */
+ case BPF_JMP32 | BPF_JA:
+ if (imm == 0)
+ break;
+ if (emit_ja(ctx, imm) < 0)
+ goto toofar;
+ break;
/* PC += off if dst == src */
/* PC += off if dst != src */
/* PC += off if dst & src */
diff --git a/arch/mips/net/bpf_jit_comp64.c b/arch/mips/net/bpf_jit_comp64.c
index 8359ad3f6992..994589c3de46 100644
--- a/arch/mips/net/bpf_jit_comp64.c
+++ b/arch/mips/net/bpf_jit_comp64.c
@@ -1041,6 +1041,13 @@ int build_insn(const struct bpf_insn *insn, struct jit_context *ctx)
if (finish_jmp(ctx, jmp, off) < 0)
goto toofar;
break;
+ /* PC += imm */
+ case BPF_JMP32 | BPF_JA:
+ if (imm == 0)
+ break;
+ if (emit_ja(ctx, imm) < 0)
+ goto toofar;
+ break;
/* PC += off if dst == src */
/* PC += off if dst != src */
/* PC += off if dst & src */