Message ID | 20230605070124.3741859-7-mark.rutland@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2501559vqr; Mon, 5 Jun 2023 00:12:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5yAA9+79XpWstp4/KsjkxKXLoIMsNAxGTc+lOB9UTAuYHqMKLYVCi9e8RzInROMqqjtQ5K X-Received: by 2002:a05:6a00:2d10:b0:65d:98a2:8876 with SMTP id fa16-20020a056a002d1000b0065d98a28876mr60887pfb.2.1685949179037; Mon, 05 Jun 2023 00:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685949179; cv=none; d=google.com; s=arc-20160816; b=uDJ9heeG7gRH2xmdYYiuOxsOrBAP0rfWoDi0DnCru5y3NRiRhKTKa5+QBzhyAyHDeI CNJvGxTyfuC9EsvdtywxMqkCIFVCTT3qm1hkciwyNIqQUpFmlaK5mrgCq3tmrLNQh8Xs /2l7cJLHwGtqx4aGyN0NFr4tLIb/h1uN95NRwrZbb8Nd+BDH9kKT6C9WBMwitcwDYm4t K6RNgm4vmooVJh2Xr+9WTpn13oiAvatEGSl01gXgBgYZVEKGxBb6QJYaUtIe1C9lBf+K mdQGFXpAIT91uZpLXjHp3Xxkfe+8p+jqYqJClzL1sGOEJk/glTyqiqcmlIBgABPfG7tH 07Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=20gvWKGWC5QlBhUE10TZ0RbsxhnZU8fpuMtJQE06lCs=; b=JfQLlPn8C0A5iY+vG1oWhA5nPvUyOuDo9D5QYBCQZ/91sywt/eB6SyyAvFOlXuMzvn dipMf6zlAOWzv7ogTZLya4e93wPXlczhy6OnmYod6PsCtgzWIUU+g9gq+cTn6AvzteOV 0I2pYYtZLLtLDk0nOg8VdEapwbi8TWz1qEcdKT4FYGXishxD+jEpylSOeoEUU1f/1pmN nZKCHQaS54UeFalqZh7Zm2rHNPYyBptncAL3ueFOqXBuhmfh/PKpH6ZDvpFw9YoJ7FJS h/xZXSbwNpVpCxR11MoTyJIZ00eb6E5xRGBHnSxrGrR4nctrpgb6Mw2RfOHW2o+63Wub FcSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e63-20020a636942000000b00543c8ad57f1si173394pgc.67.2023.06.05.00.12.46; Mon, 05 Jun 2023 00:12:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbjFEHCY (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Mon, 5 Jun 2023 03:02:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbjFEHCB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Jun 2023 03:02:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9B6D1DA; Mon, 5 Jun 2023 00:01:48 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF301152B; Mon, 5 Jun 2023 00:02:33 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7AAE23F793; Mon, 5 Jun 2023 00:01:46 -0700 (PDT) From: Mark Rutland <mark.rutland@arm.com> To: linux-kernel@vger.kernel.org Cc: akiyks@gmail.com, boqun.feng@gmail.com, corbet@lwn.net, keescook@chromium.org, linux@armlinux.org.uk, linux-doc@vger.kernel.org, mark.rutland@arm.com, mchehab@kernel.org, paulmck@kernel.org, peterz@infradead.org, rdunlap@infradead.org, sstabellini@kernel.org, will@kernel.org Subject: [PATCH v2 06/27] locking/atomic: arm: add preprocessor symbols Date: Mon, 5 Jun 2023 08:01:03 +0100 Message-Id: <20230605070124.3741859-7-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605070124.3741859-1-mark.rutland@arm.com> References: <20230605070124.3741859-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767845846618580463?= X-GMAIL-MSGID: =?utf-8?q?1767845846618580463?= |
Series |
locking/atomic: restructuring + kerneldoc
|
|
Commit Message
Mark Rutland
June 5, 2023, 7:01 a.m. UTC
Some atomics can be implemented in several different ways, e.g. FULL/ACQUIRE/RELEASE ordered atomics can be implemented in terms of RELAXED atomics, and ACQUIRE/RELEASE/RELAXED can be implemented in terms of FULL ordered atomics. Other atomics are optional, and don't exist in some configurations (e.g. not all architectures implement the 128-bit cmpxchg ops). Subsequent patches will require that architectures define a preprocessor symbol for any atomic (or ordering variant) which is optional. This will make the fallback ifdeffery more robust, and simplify future changes. Add the required definitions to arch/arm. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> --- arch/arm/include/asm/atomic.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index 9458d47ff209c..f0e3b01afa746 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h @@ -197,6 +197,16 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \ return val; \ } +#define arch_atomic_add_return arch_atomic_add_return +#define arch_atomic_sub_return arch_atomic_sub_return +#define arch_atomic_fetch_add arch_atomic_fetch_add +#define arch_atomic_fetch_sub arch_atomic_fetch_sub + +#define arch_atomic_fetch_and arch_atomic_fetch_and +#define arch_atomic_fetch_andnot arch_atomic_fetch_andnot +#define arch_atomic_fetch_or arch_atomic_fetch_or +#define arch_atomic_fetch_xor arch_atomic_fetch_xor + static inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new) { int ret; @@ -212,8 +222,6 @@ static inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new) } #define arch_atomic_cmpxchg arch_atomic_cmpxchg -#define arch_atomic_fetch_andnot arch_atomic_fetch_andnot - #endif /* __LINUX_ARM_ARCH__ */ #define ATOMIC_OPS(op, c_op, asm_op) \