Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5248064rwd; Mon, 5 Jun 2023 00:11:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60Jfo1BfeKv/9/v8IAPMoU6FV3rORwV/WKKDKxDbN+gClg4qt+Za2Jt162DpZGs3ULEywn X-Received: by 2002:a67:f486:0:b0:43b:2e6d:45f6 with SMTP id o6-20020a67f486000000b0043b2e6d45f6mr2397676vsn.5.1685949084660; Mon, 05 Jun 2023 00:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685949084; cv=none; d=google.com; s=arc-20160816; b=lDqt2sNPoiIKUnMCpdLQA+k6ev6nYzHUvtTAvldEm+ogPkKbZp/539UAT0Ll7Fekf1 lD/lXUCrjF5X/bZHlPaeBrrsYVyMwiGECdmPz07sRa/i5C1x8WVkaenrcLKCGTGRedNh zO1khTePYybAWjSiUxbFErCqER83zBe3vjkUTBhluQy3At6GRGiDUmMEX6pVHOr/SFla E300vARqhSYo1OL0aaB5i1Tj3nNROO/YVkOZ4NAB/gAFAdG4NsHs71kzoo9XkbYdcuyp pwkQYuZRJs6T3w2UsK7nDvCggs4Zm30z7mWPy44ycnA9Z5ggYC6fkwA327ppIfRdubA6 7k2Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m64-20020a632643000000b0053fce94d036si3895791pgm.434.2023.06.05.00.11.12; Mon, 05 Jun 2023 00:11:24 -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 S230348AbjFEHCY (ORCPT + 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 ); 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 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Kees Cook Cc: Boqun Feng Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Will Deacon --- 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) \ -- 2.30.2