[PATCH v2 1/4] powerpc64/bpf: Add support for instruction array
Hari Bathini
hbathini at linux.ibm.com
Tue Mar 31 21:38:12 AEDT 2026
On 27/02/26 7:13 am, adubey at linux.ibm.com wrote:
> From: Abhishek Dubey <adubey at linux.ibm.com>
>
> On loading the BPF program, the verifier might adjust/omit some
> instructions. The adjusted instruction offset is accounted in the
> map containing original instruction -> xlated mapping. This patch
> add ppc64 JIT support to additionally build the xlated->jitted
> mapping for every instruction present in instruction array. This
> change is needed to enable support for indirect jumps, added in a
> subsequent patch.
>
> Invoke bpf_prog_update_insn_ptrs() with offset pair of xlated_offset
> and jited_offset. The offset mapping is already available, which is
> being used for bpf_prog_fill_jited_linfo() and can be directly used
> for bpf_prog_update_insn_ptrs() as well.
>
> Additional details present at:
>
> commit b4ce5923e780 ("bpf, x86: add new map type: instructions array")
>
Looks good to me. Except for a minor nit below..
Acked-by: Hari Bathini <hbathini at linux.ibm.com>
> Signed-off-by: Abhishek Dubey <adubey at linux.ibm.com>
> ---
> arch/powerpc/net/bpf_jit_comp.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index 9ec5ab9b020e..620667c3400b 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -373,6 +373,16 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
> goto out_addrs;
> }
> bpf_prog_fill_jited_linfo(fp, addrs);
> + /*
> + * On ABI V1, executable code starts after the function
> + * descriptor, so adjust base accordingly.
> + */
> +#ifdef CONFIG_PPC64_ELF_ABI_V1
> + bpf_prog_update_insn_ptrs(fp, addrs,
> + (void *)fimage + FUNCTION_DESCR_SIZE);
> +#else
> + bpf_prog_update_insn_ptrs(fp, addrs, fimage);
> +#endif
You don't need this ifdeffery as FUNCTION_DESCR_SIZE is already defined
based on this CONFIG option.
- Hari
More information about the Linuxppc-dev
mailing list