diff options
| author | Pu Lehui <pulehui@huawei.com> | 2025-07-19 09:17:26 +0000 |
|---|---|---|
| committer | Daniel Borkmann <daniel@iogearbox.net> | 2025-08-15 10:46:51 +0200 |
| commit | de39d2c4cdb68ece47ff9609dd5c9e87b918d1bd (patch) | |
| tree | e0ebde706aa94fef356bb5d6d4834684935b6d73 | |
| parent | 5090b339eeb3417baa940d690923e630e077d8f8 (diff) | |
riscv, bpf: Add Zacas instructions
Add Zacas instructions introduced by [0] to reduce code size and
improve performance of RV64 JIT.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
Link: https://github.com/riscvarchive/riscv-zacas/releases/download/v1.0/riscv-zacas.pdf [0]
Link: https://lore.kernel.org/bpf/20250719091730.2660197-7-pulehui@huaweicloud.com
| -rw-r--r-- | arch/riscv/net/bpf_jit.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/riscv/net/bpf_jit.h b/arch/riscv/net/bpf_jit.h index 0964df48c25e..2351fba5d3e7 100644 --- a/arch/riscv/net/bpf_jit.h +++ b/arch/riscv/net/bpf_jit.h @@ -751,6 +751,17 @@ static inline u16 rvc_swsp(u32 imm8, u8 rs2) return rv_css_insn(0x6, imm, rs2, 0x2); } +/* RVZACAS instructions. */ +static inline u32 rvzacas_amocas_w(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) +{ + return rv_amo_insn(0x5, aq, rl, rs2, rs1, 2, rd, 0x2f); +} + +static inline u32 rvzacas_amocas_d(u8 rd, u8 rs2, u8 rs1, u8 aq, u8 rl) +{ + return rv_amo_insn(0x5, aq, rl, rs2, rs1, 3, rd, 0x2f); +} + /* RVZBA instructions. */ static inline u32 rvzba_sh2add(u8 rd, u8 rs1, u8 rs2) { |
