From patchwork Mon May 22 12:24:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 97394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1410688vqo; Mon, 22 May 2023 05:30:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KNY5G05RcqPVwDf5AJoUS3K3HrVaia41R5lYBKbDgS+swqmnr3qsRkNj0MLxYoEFvdxxQ X-Received: by 2002:a17:90a:e644:b0:24e:1215:c280 with SMTP id ep4-20020a17090ae64400b0024e1215c280mr10244997pjb.45.1684758621078; Mon, 22 May 2023 05:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684758621; cv=none; d=google.com; s=arc-20160816; b=i1hglvNq5+clKKji2DV6gxXaosG8Lb0Maui0XCJ/+cE7fgm/ngFtGfCI5v7o4MTnkD +sYQdUsZXGOym5qoIfZ4VU2ATO3JeExzU9nsvot+d/fkZQRezZmzWoMKKD57aazBhuq7 53m07UkcjOizf/vsCh8vq/i8mj0WMYE2/fIdPv7M3s1jogdOa5seYQXy2bESeN5D56Kp rIGq9ZNN9eoijK5vfIWmjTnxKM/c2mUipItmeWQkl4YSHScLtxmKKAYW8LylJdcU7p86 /paXpUDWrU2/dHlRBD8NCKqYOCwacowy3RoMC2iMBiOJcuG1Q9fLFGlrSaCdviHmiXAR NrVg== 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=ko8bYLMKJkH7GNpft9Su7Hpxb9vsoq7XQD48RAldmSs=; b=P3CXjp5zBq1ng7vlud1xC9YX0c5YHesnvMnutWjHk3ctZyIzAig2Ywc3DsjP6sQaHC YfHjXsgbsczbT8K8ETxnd7lB3Cjxlth1GGekU5SQTPVmVkMUwTBNpYQu7ngsYc7M7YFd uiYv2kCAmHZJulxLmk7jgB2lJatGdgLrtpfeFsjrutGALaGGwfOMrY1kS3IR4OIi+MaC NBFoBnt9e9HtShWKW2mAvbeSAJ4JCZ/h9pSY2UzNqYVb9b3wbZJwjvXSxOQvPHhJXHkr Vfy2X6BGGEXK9t50y7/YVR4IRhqiuTevnv2wi28P0k/6JoEIsSEmeSVQsmJ+br3rVjzI 4lMQ== 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 q1-20020a17090a2dc100b00250cb2a2000si4586316pjm.113.2023.05.22.05.30.05; Mon, 22 May 2023 05:30:21 -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 S234068AbjEVM1t (ORCPT + 99 others); Mon, 22 May 2023 08:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233289AbjEVM0x (ORCPT ); Mon, 22 May 2023 08:26:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72286F9; Mon, 22 May 2023 05:25:05 -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 9CC54152B; Mon, 22 May 2023 05:25:37 -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 F2B553F59C; Mon, 22 May 2023 05:24:50 -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-arch@vger.kernel.org, linux@armlinux.org.uk, linux-doc@vger.kernel.org, mark.rutland@arm.com, paulmck@kernel.org, peterz@infradead.org, sstabellini@kernel.org, will@kernel.org Subject: [PATCH 06/26] locking/atomic: arm: add preprocessor symbols Date: Mon, 22 May 2023 13:24:09 +0100 Message-Id: <20230522122429.1915021-7-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230522122429.1915021-1-mark.rutland@arm.com> References: <20230522122429.1915021-1-mark.rutland@arm.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766597455492558766?= X-GMAIL-MSGID: =?utf-8?q?1766597455492558766?= 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 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) \