mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next v4 0/3] Add bpf stack arguments support for RV64
@ 2026-09-05  7:04 Pu Lehui
  2026-09-05  7:04 ` [PATCH bpf-next v4 1/3] riscv, bpf: Remap BPF_REG_0 and RV_REG_TCC Pu Lehui
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pu Lehui @ 2026-09-05  7:04 UTC (permalink / raw)
  To: bpf, linux-riscv, linux-kernel, Feng Jiang
  Cc: Björn Töpel, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
	Emil Tsalapatis, Ihor Solodrai, Puranjay Mohan, Paul Walmsley,
	Palmer Dabbelt, Alexandre Ghiti, Pu Lehui

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 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@kylinos.cn

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@kylinos.cn


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

 arch/riscv/net/bpf_jit.h                      |  1 +
 arch/riscv/net/bpf_jit_comp64.c               | 87 ++++++++++++++++---
 arch/riscv/net/bpf_jit_core.c                 |  6 ++
 arch/riscv/net/bpf_timed_may_goto.S           |  4 +-
 .../bpf/progs/btf__stack_arg_precision.c      |  3 +-
 .../bpf/progs/btf__verifier_stack_arg_order.c |  3 +-
 tools/testing/selftests/bpf/progs/stack_arg.c |  3 +-
 .../selftests/bpf/progs/stack_arg_kfunc.c     |  3 +-
 .../selftests/bpf/progs/stack_arg_precision.c |  3 +-
 .../selftests/bpf/progs/verifier_jit_inline.c |  2 +-
 .../selftests/bpf/progs/verifier_ldsx.c       |  6 +-
 .../selftests/bpf/progs/verifier_stack_arg.c  |  3 +-
 .../bpf/progs/verifier_stack_arg_order.c      |  3 +-
 13 files changed, 101 insertions(+), 26 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-09-05  8:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-05  7:04 [PATCH bpf-next v4 0/3] Add bpf stack arguments support for RV64 Pu Lehui
2026-09-05  7:04 ` [PATCH bpf-next v4 1/3] riscv, bpf: Remap BPF_REG_0 and RV_REG_TCC Pu Lehui
2026-09-05  8:00   ` bot+bpf-ci
2026-09-05  8:11     ` Pu Lehui
2026-09-05  7:04 ` [PATCH bpf-next v4 2/3] riscv, bpf: Add BPF stack arguments support for RV64 JIT Pu Lehui
2026-09-05  8:00   ` bot+bpf-ci
2026-09-05  8:15     ` Pu Lehui
2026-09-05  7:04 ` [PATCH bpf-next v4 3/3] selftests/bpf: Enable stack argument tests for RV64 Pu Lehui
2026-09-05  7:45   ` bot+bpf-ci
2026-09-05  8:05     ` Pu Lehui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®