bpf, riscv: Implement bpf_addr_space_cast instruction
authorPuranjay Mohan <puranjay12@gmail.com>
Thu, 4 Apr 2024 11:42:03 +0000 (11:42 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 4 Apr 2024 14:48:42 +0000 (16:48 +0200)
commit21ab0b6d0cfcb8aa98e33baa83f933f963514027
tree95efbd4fc58efc0831780ed0dd79305f136e4375
parent633a6e01d1a20b24a16899094c249a8cb2aad4b2
bpf, riscv: Implement bpf_addr_space_cast instruction

LLVM generates bpf_addr_space_cast instruction while translating
pointers between native (zero) address space and
__attribute__((address_space(N))). The addr_space=0 is reserved as
bpf_arena address space.

rY = addr_space_cast(rX, 0, 1) is processed by the verifier and
converted to normal 32-bit move: wX = wY

rY = addr_space_cast(rX, 1, 0) has to be converted by JIT.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Björn Töpel <bjorn@rivosinc.com>
Tested-by: Pu Lehui <pulehui@huawei.com>
Reviewed-by: Pu Lehui <pulehui@huawei.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/bpf/20240404114203.105970-3-puranjay12@gmail.com
arch/riscv/net/bpf_jit.h
arch/riscv/net/bpf_jit_comp64.c
arch/riscv/net/bpf_jit_core.c