From: Hari Bathini <hbathini@linux.ibm.com>
To: adubey@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, maddy@linux.ibm.com
Subject: Re: [PATCH v2 3/4] powerpc64/bpf: Add support for indirect jump
Date: Tue, 31 Mar 2026 16:12:38 +0530 [thread overview]
Message-ID: <b8da91b7-94f3-4614-8b92-5085734953d4@linux.ibm.com> (raw)
In-Reply-To: <20260227014315.39980-4-adubey@linux.ibm.com>
On 27/02/26 7:13 am, adubey@linux.ibm.com wrote:
> From: Abhishek Dubey <adubey@linux.ibm.com>
>
> Add support for a new instruction
>
> BPF_JMP|BPF_X|BPF_JA, SRC=0, DST=Rx, off=0, imm=0
>
> which does an indirect jump to a location stored in Rx. The
> register Rx should have type PTR_TO_INSN. This new type ensures
> that the Rx register contains a value (or a range of values)
> loaded from a correct jump table – map of type instruction array.
>
> Support indirect jump to all registers in powerpc64 JIT using
> the ctr register. Move Rx content to ctr register, then invoke
> bctr instruction to branch to address stored in ctr register.
> Skip save and restore of TOC as the jump is always within the
> program context.
>
Looks good to me.
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
> Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
> ---
> arch/powerpc/net/bpf_jit_comp64.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
> index c1d011046d8b..2cb550ca1dec 100644
> --- a/arch/powerpc/net/bpf_jit_comp64.c
> +++ b/arch/powerpc/net/bpf_jit_comp64.c
> @@ -1627,6 +1627,14 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
> addrs[++i] = ctx->idx * 4;
> break;
>
> + /*
> + * JUMP reg
> + */
> + case BPF_JMP | BPF_JA | BPF_X:
> + EMIT(PPC_RAW_MTCTR(dst_reg));
> + EMIT(PPC_RAW_BCTR());
> + break;
> +
> /*
> * Return/Exit
> */
next prev parent reply other threads:[~2026-03-31 10:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 1:43 [PATCH v2 0/4] powerpc64/bpf: Add support for instruction array and indirect jump adubey
2026-02-27 1:43 ` [PATCH v2 1/4] powerpc64/bpf: Add support for instruction array adubey
2026-03-31 10:38 ` Hari Bathini
2026-02-27 1:43 ` [PATCH v2 2/4] selftest/bpf: Enable instruction array test for powerpc64 adubey
2026-02-27 1:43 ` [PATCH v2 3/4] powerpc64/bpf: Add support for indirect jump adubey
2026-03-31 10:42 ` Hari Bathini [this message]
2026-02-27 1:43 ` [PATCH v2 4/4] selftest/bpf: Enable gotox tests for powerpc64 adubey
2026-02-27 15:28 ` [PATCH v2 0/4] powerpc64/bpf: Add support for instruction array and indirect jump Venkat
2026-03-03 5:12 ` Venkat Rao Bagalkote
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8da91b7-94f3-4614-8b92-5085734953d4@linux.ibm.com \
--to=hbathini@linux.ibm.com \
--cc=adubey@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox