Re: [PATCH bpf-next v5 0/3] Add bpf stack arguments support for RV64

From: Björn Töpel

Date: Sun Sep 06 2026 - 10:31:04 EST


Pu Lehui <pulehui@xxxxxxxxxxxxxxx> writes:

> Implement bpf_jit_supports_stack_args() on RV64 JIT to allow bpf
> subprogs and kfuncs to pass and receive more than 5 arguments.
>
> Tested on riscv64 QEMU with LLVM main [1]; BPF-to-BPF and kfunc
> selftests pass.
>
> [1] https://github.com/llvm/llvm-project/pull/189060
>
> ---
> Changes in v5:
> - Add RV_EXTRA_STK_ARGS macro to represent the exceeding stack args
> passed in riscv arg regs. (BPF CI)
> - Optimize emit_stack_arg_st() by materializing immediates directly
> into destination registers. (BPF CI)
> - Update stale comments. (BPF CI and sashiko)
>
> Changes in v4:
> - Remap BPF_REG_0 and RV_REG_TCC to align the calling convention of
> bpf2bpf and kfunc calls with the riscv abi.
> - Adapt the bpf stack arguments implementation based on change 1.
>
> Changes in v3:
> - Drop the exceptions.c guard change: the guarded programs use
> bpf_throw(), unsupported by the RV64 JIT, so the test is denylisted
> on riscv64 and the guard has no effect. (BPF CI)
> - Link to v2: https://lore.kernel.org/r/20260813-bpf-riscv-stack-args-v2-0-efea8f9b3fe1@xxxxxxxxxx
>
> Changes in v2:
> - Sign-extend 32-bit kfunc arguments passed on the stack (args 9+),
> matching the register path and the RISC-V psABI. (Sashiko)
> - Restrict the riscv selftest guard to __riscv_xlen == 64 so the
> tests are not enabled on RV32. (Sashiko)
> - Link to v1: https://lore.kernel.org/r/20260812-bpf-riscv-stack-args-v1-0-67b246806e59@xxxxxxxxxx
>
> Feng Jiang (2):
> riscv, bpf: Add BPF stack arguments support for RV64 JIT
> selftests/bpf: Enable stack argument tests for RV64
>
> Pu Lehui (1):
> riscv, bpf: Remap BPF_REG_0 and RV_REG_TCC

Thanks!

For the series:

Acked-by: Björn Töpel <bjorn@xxxxxxxxxx>