Skip to content

Commit 32c563d

Browse files
author
Alexei Starovoitov
committed
Merge branch 'bpf-riscv64-support-load-acquire-and-store-release-instructions'
Peilin Ye says: ==================== bpf, riscv64: Support load-acquire and store-release instructions Hi all! Patchset [1] introduced BPF load-acquire (BPF_LOAD_ACQ) and store-release (BPF_STORE_REL) instructions, and added x86-64 and arm64 JIT compiler support. As a follow-up, this v2 patchset supports load-acquire and store-release instructions for the riscv64 JIT compiler, and introduces some related selftests/ changes. Specifically: * PATCH 1 makes insn_def_regno() handle load-acquires properly for bpf_jit_needs_zext() (true for riscv64) architectures * PATCH 2, 3 from Andrea Parri add the actual support to the riscv64 JIT compiler * PATCH 4 optimizes code emission by skipping redundant zext instructions inserted by the verifier * PATCH 5, 6 and 7 are minor selftest/ improvements * PATCH 8 enables (non-arena) load-acquire/store-release selftests for riscv64 v1: https://lore.kernel.org/bpf/[email protected]/ Changes since v1: * add Acked-by:, Reviewed-by: and Tested-by: tags from Lehui and Björn * simplify code logic in PATCH 1 (Lehui) * in PATCH 3, avoid changing 'return 0;' to 'return ret;' at the end of bpf_jit_emit_insn() (Lehui) Please refer to individual patches for details. Thanks! [1] https://lore.kernel.org/all/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents b69d441 + d313146 commit 32c563d

File tree

8 files changed

+313
-146
lines changed

8 files changed

+313
-146
lines changed

arch/riscv/net/bpf_jit.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,21 @@ static inline u32 rv_fence(u8 pred, u8 succ)
608608
return rv_i_insn(imm11_0, 0, 0, 0, 0xf);
609609
}
610610

611+
static inline void emit_fence_r_rw(struct rv_jit_context *ctx)
612+
{
613+
emit(rv_fence(0x2, 0x3), ctx);
614+
}
615+
616+
static inline void emit_fence_rw_w(struct rv_jit_context *ctx)
617+
{
618+
emit(rv_fence(0x3, 0x1), ctx);
619+
}
620+
621+
static inline void emit_fence_rw_rw(struct rv_jit_context *ctx)
622+
{
623+
emit(rv_fence(0x3, 0x3), ctx);
624+
}
625+
611626
static inline u32 rv_nop(void)
612627
{
613628
return rv_i_insn(0, 0, 0, 0, 0x13);

0 commit comments

Comments
 (0)