bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next PATCH 0/2] bpf, riscv: Add BPF stack arguments support for RV64 JIT
@ 2026-08-12  6:15 Feng Jiang
  2026-08-12  6:15 ` [bpf-next PATCH 1/2] " Feng Jiang
  2026-08-12  6:15 ` [bpf-next PATCH 2/2] selftests/bpf: Enable stack argument tests for riscv Feng Jiang
  0 siblings, 2 replies; 5+ messages in thread
From: Feng Jiang @ 2026-08-12  6:15 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, Luke Nelson, Xi Wang, Björn Töpel,
	Pu Lehui, Puranjay Mohan, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Shuah Khan, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: bpf, linux-riscv, linux-kernel, linux-kselftest, llvm, Feng Jiang

Port the BPF stack argument feature (BPF_REG_PARAMS / r11) to the
RV64 JIT, matching what x86 and arm64 already do.

BPF-to-BPF calls keep all extra arguments on the stack.  For kfunc
calls, the JIT loads arguments 6-8 into A5-A7 at the call site to
satisfy the RISC-V C calling convention.

Tested on riscv64 QEMU with LLVM main [1]; BPF-to-BPF and kfunc
selftests pass.

[1] https://github.com/llvm/llvm-project/pull/189060

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
---
Feng Jiang (2):
      bpf, riscv: Add BPF stack arguments support for RV64 JIT
      selftests/bpf: Enable stack argument tests for riscv

 arch/riscv/net/bpf_jit.h                           |  1 +
 arch/riscv/net/bpf_jit_comp64.c                    | 75 +++++++++++++++++++++-
 arch/riscv/net/bpf_jit_core.c                      |  4 ++
 .../selftests/bpf/progs/btf__stack_arg_precision.c |  2 +-
 .../bpf/progs/btf__verifier_stack_arg_order.c      |  2 +-
 tools/testing/selftests/bpf/progs/exceptions.c     |  2 +-
 tools/testing/selftests/bpf/progs/stack_arg.c      |  2 +-
 .../testing/selftests/bpf/progs/stack_arg_kfunc.c  |  2 +-
 .../selftests/bpf/progs/stack_arg_precision.c      |  2 +-
 .../selftests/bpf/progs/verifier_stack_arg.c       |  2 +-
 .../selftests/bpf/progs/verifier_stack_arg_order.c |  2 +-
 11 files changed, 85 insertions(+), 11 deletions(-)
---
base-commit: d114bb98936770c501c958bf2bc5fb6b7c0bad7b
change-id: 20260728-bpf-riscv-stack-args-6350d066a1e9

Best regards,
-- 
Feng Jiang <jiangfeng@kylinos.cn>


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

end of thread, other threads:[~2026-08-12  6:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  6:15 [bpf-next PATCH 0/2] bpf, riscv: Add BPF stack arguments support for RV64 JIT Feng Jiang
2026-08-12  6:15 ` [bpf-next PATCH 1/2] " Feng Jiang
2026-08-12  6:28   ` sashiko-bot
2026-08-12  6:15 ` [bpf-next PATCH 2/2] selftests/bpf: Enable stack argument tests for riscv Feng Jiang
2026-08-12  6:28   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).