Re: [PATCH bpf-next v3 6/9] arm64: insn: Add load-acquire and store-release instructions
From: Alexei Starovoitov
Date: Fri Feb 21 2025 - 22:12:53 EST
On Wed, Feb 19, 2025 at 5:21 PM Peilin Ye <yepeilin@xxxxxxxxxx> wrote:
>
> Add load-acquire ("load_acq", LDAR{,B,H}) and store-release
> ("store_rel", STLR{,B,H}) instructions. Breakdown of encoding:
>
> size L (Rs) o0 (Rt2) Rn Rt
> mask (0x3fdffc00): 00 111111 1 1 0 11111 1 11111 00000 00000
> value, load_acq (0x08dffc00): 00 001000 1 1 0 11111 1 11111 00000 00000
> value, store_rel (0x089ffc00): 00 001000 1 0 0 11111 1 11111 00000 00000
>
> As suggested by Xu [1], include all Should-Be-One (SBO) bits ("Rs" and
> "Rt2" fields) in the "mask" and "value" numbers.
>
> It is worth noting that we are adding the "no offset" variant of STLR
> instead of the "pre-index" variant, which has a different encoding.
>
> Reference: Arm Architecture Reference Manual (ARM DDI 0487K.a,
> ID032224),
>
> * C6.2.161 LDAR
> * C6.2.353 STLR
>
> [1] https://lore.kernel.org/bpf/4e6641ce-3f1e-4251-8daf-4dd4b77d08c4@xxxxxxxxxxxxxxx/
>
> Signed-off-by: Peilin Ye <yepeilin@xxxxxxxxxx>
> ---
> arch/arm64/include/asm/insn.h | 8 ++++++++
> arch/arm64/lib/insn.c | 29 +++++++++++++++++++++++++++++
> 2 files changed, 37 insertions(+)
>
> diff --git a/arch/arm64/include/asm/insn.h b/arch/arm64/include/asm/insn.h
> index 2d8316b3abaf..39577f1d079a 100644
> --- a/arch/arm64/include/asm/insn.h
> +++ b/arch/arm64/include/asm/insn.h
> @@ -188,8 +188,10 @@ enum aarch64_insn_ldst_type {
> AARCH64_INSN_LDST_STORE_PAIR_PRE_INDEX,
> AARCH64_INSN_LDST_LOAD_PAIR_POST_INDEX,
> AARCH64_INSN_LDST_STORE_PAIR_POST_INDEX,
> + AARCH64_INSN_LDST_LOAD_ACQ,
> AARCH64_INSN_LDST_LOAD_EX,
> AARCH64_INSN_LDST_LOAD_ACQ_EX,
> + AARCH64_INSN_LDST_STORE_REL,
> AARCH64_INSN_LDST_STORE_EX,
> AARCH64_INSN_LDST_STORE_REL_EX,
> AARCH64_INSN_LDST_SIGNED_LOAD_IMM_OFFSET,
Xu, Puranjay, other arm experts,
Please help review these patches.
Thanks!