From nobody Tue Jan 04 10:50:20 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0E5F71936F98; Tue, 4 Jan 2022 10:50:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JSqC15f97z4R8D; Tue, 4 Jan 2022 10:50:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3251178D2; Tue, 4 Jan 2022 10:50:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 204AoK00044761; Tue, 4 Jan 2022 10:50:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 204AoKhd044755; Tue, 4 Jan 2022 10:50:20 GMT (envelope-from git) Date: Tue, 4 Jan 2022 10:50:20 GMT Message-Id: <202201041050.204AoKhd044755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 713b7f1a3b6d - stable/13 - Add atomic_testandset_acq_* on arm64 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 713b7f1a3b6d21182a6e36fd0da2cad0b9eb7d95 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641293422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I2H6iOrhiyEEPoFfGzO62Lvi0DYay+J2NMmuoh0NoPc=; b=iY6QMwkeoUbbJgSt64NOo3UZYZCZldaHed0GCPBI8xS38mGEtk8jUe6yEqRFxIZCvnue3e hdOrySpEsbXYL8GQWmXdBZjxtFJ/1zKiE04IIhx0u0Ok6jaVq/UkI/mP80N6K4J7LpnLx+ 3u1QfeSLf54aKWZ9uDkFHStKWgnXY9wFcSreqpOBXcOzF70TJmLL+hspZpzRSEdun6aXZm 8wtMtipMNqEFld1lffyvZ6VT2dzZh5QnIFYeyKTbYNB044jS/EPioAPLJ6NghBFlGwz0rw +/ov0dcs3Y5I+vx0QUN88kFvC5Z/l3CUurn2sKzTjC5MyElj/joFdOEAMQ0Daw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641293422; a=rsa-sha256; cv=none; b=AJpgol/Uxw5iM1pbKyhC5S1IdTCI8deK4Qb7ltCbKXEP5kgtElmgqNfM5baSN6nllo59rA jOwxJyXKjXwfPCidQlaphkOAPKXL3V9YXT0TlMeAWSpuK2QWqRrHE4W4qWcV0lpnWFz0A4 bUw2L1amPHoXNy4ftCCKnrhnoxPrlN6y5I3CawUMXoTe9Y+trv9Qccpp1HQ+3S/6s4/i6M iU+dePIAmze2JAJaA8enMu43rJQGjdpUyoXI3SSlOpiLVUPGLQSiH2/ajpT+Zq2Sya1aro /Okl5rW43Uk7q7KaHW6Nk3nNW/ss8fxcF5Fc4DInNTwyZQGK43FemdjOdNigrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=713b7f1a3b6d21182a6e36fd0da2cad0b9eb7d95 commit 713b7f1a3b6d21182a6e36fd0da2cad0b9eb7d95 Author: Andrew Turner AuthorDate: 2021-12-20 13:49:59 +0000 Commit: Andrew Turner CommitDate: 2022-01-04 10:08:32 +0000 Add atomic_testandset_acq_* on arm64 We only need to include sys/_atomic_subword.h on arm64 to provide atomic_testandset_acq_long. Add an implementation in the arm64 atomic.h based on the existing atomic_testandset macro. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33587 (cherry picked from commit 02c16e2174baa756997600a8139f19f218da0a8f) --- sys/arm64/include/atomic.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 6c63357f85b9..fe15b14181b4 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -399,19 +399,19 @@ _ATOMIC_READANDCLEAR_PROTO(t, ) \ _ATOMIC_SWAP_IMPL(32, w, wzr) _ATOMIC_SWAP_IMPL(64, , xzr) -#define _ATOMIC_TEST_OP_PROTO(t, op, flav) \ +#define _ATOMIC_TEST_OP_PROTO(t, op, bar, flav) \ static __inline int \ -atomic_testand##op##_##t##flav(volatile uint##t##_t *p, u_int val) +atomic_testand##op##_##bar##t##flav(volatile uint##t##_t *p, u_int val) -#define _ATOMIC_TEST_OP_IMPL(t, w, op, llsc_asm_op, lse_asm_op) \ -_ATOMIC_TEST_OP_PROTO(t, op, _llsc) \ +#define _ATOMIC_TEST_OP_IMPL(t, w, op, llsc_asm_op, lse_asm_op, bar, a) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, _llsc) \ { \ uint##t##_t mask, old, tmp; \ int res; \ \ mask = ((uint##t##_t)1) << (val & (t - 1)); \ __asm __volatile( \ - "1: ldxr %"#w"2, [%3]\n" \ + "1: ld"#a"xr %"#w"2, [%3]\n" \ " "#llsc_asm_op" %"#w"0, %"#w"2, %"#w"4\n" \ " stxr %w1, %"#w"0, [%3]\n" \ " cbnz %w1, 1b\n" \ @@ -423,14 +423,14 @@ _ATOMIC_TEST_OP_PROTO(t, op, _llsc) \ return ((old & mask) != 0); \ } \ \ -_ATOMIC_TEST_OP_PROTO(t, op, _lse) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, _lse) \ { \ uint##t##_t mask, old; \ \ mask = ((uint##t##_t)1) << (val & (t - 1)); \ __asm __volatile( \ ".arch_extension lse\n" \ - "ld"#lse_asm_op" %"#w"2, %"#w"0, [%1]\n" \ + "ld"#lse_asm_op#a" %"#w"2, %"#w"0, [%1]\n" \ ".arch_extension nolse\n" \ : "=r" (old) \ : "r" (p), "r" (mask) \ @@ -440,17 +440,19 @@ _ATOMIC_TEST_OP_PROTO(t, op, _lse) \ return ((old & mask) != 0); \ } \ \ -_ATOMIC_TEST_OP_PROTO(t, op, ) \ +_ATOMIC_TEST_OP_PROTO(t, op, bar, ) \ { \ if (_ATOMIC_LSE_SUPPORTED) \ - return (atomic_testand##op##_##t##_lse(p, val)); \ + return (atomic_testand##op##_##bar##t##_lse(p, val)); \ else \ - return (atomic_testand##op##_##t##_llsc(p, val)); \ + return (atomic_testand##op##_##bar##t##_llsc(p, val)); \ } #define _ATOMIC_TEST_OP(op, llsc_asm_op, lse_asm_op) \ - _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op) \ - _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op) + _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op, , ) \ + _ATOMIC_TEST_OP_IMPL(32, w, op, llsc_asm_op, lse_asm_op, acq_, a) \ + _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op, , ) \ + _ATOMIC_TEST_OP_IMPL(64, , op, llsc_asm_op, lse_asm_op, acq_, a) _ATOMIC_TEST_OP(clear, bic, clr) _ATOMIC_TEST_OP(set, orr, set) @@ -512,6 +514,7 @@ _ATOMIC_STORE_REL_IMPL(64, , ) #define atomic_load_acq_int atomic_load_acq_32 #define atomic_set_acq_int atomic_set_acq_32 #define atomic_subtract_acq_int atomic_subtract_acq_32 +#define atomic_testandset_acq_int atomic_testandset_acq_32 #define atomic_add_rel_int atomic_add_rel_32 #define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 @@ -550,6 +553,7 @@ _ATOMIC_STORE_REL_IMPL(64, , ) #define atomic_load_acq_long atomic_load_acq_64 #define atomic_set_acq_long atomic_set_acq_64 #define atomic_subtract_acq_long atomic_subtract_acq_64 +#define atomic_testandset_acq_long atomic_testandset_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 #define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 @@ -603,7 +607,5 @@ atomic_thread_fence_seq_cst(void) dmb(sy); } -#include - #endif /* KCSAN && !KCSAN_RUNTIME */ #endif /* _MACHINE_ATOMIC_H_ */