]> git.ipfire.org Git - thirdparty/linux.git/commit
powerpc64/bpf: Implement PROBE_ATOMIC instructions
authorSaket Kumar Bhaskar <skb99@linux.ibm.com>
Thu, 4 Sep 2025 10:08:35 +0000 (15:38 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Sat, 6 Sep 2025 10:19:44 +0000 (15:49 +0530)
commit0c1da35b0188dd565cec907a16cb5d1bd425e0e4
tree6c20171a00777dfc205fd71c4343886462842cfb
parent45ed2e8b0591eb6211d79f436f76c3af31e626af
powerpc64/bpf: Implement PROBE_ATOMIC instructions

powerpc supports BPF atomic operations using a loop around
Load-And-Reserve(LDARX/LWARX) and Store-Conditional(STDCX/STWCX)
instructions gated by sync instructions to enforce full ordering.

To implement arena_atomics, arena vm start address is added to the
dst_reg to be used for both the LDARX/LWARX and STDCX/STWCX instructions.
Further, an exception table entry is added for LDARX/LWARX
instruction to land after the loop on fault. At the end of sequence,
dst_reg is restored by subtracting arena vm start address.

bpf_jit_supports_insn() is introduced to selectively enable instruction
support as in other architectures like x86 and arm64.

Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250904100835.1100423-5-skb99@linux.ibm.com
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/net/bpf_jit_comp64.c