From patchwork Mon Jun 5 07:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 103129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2501503vqr; Mon, 5 Jun 2023 00:12:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iEmAzH+ez6bZn5BPV5Ej08mDD7Qs7hQA3Rcu4Rkm4iomLLYVvCpg20hnEWwb95+ZsZcTP X-Received: by 2002:a17:902:aa0a:b0:1b0:6e18:ce49 with SMTP id be10-20020a170902aa0a00b001b06e18ce49mr2346128plb.23.1685949169787; Mon, 05 Jun 2023 00:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685949169; cv=none; d=google.com; s=arc-20160816; b=kut2rJc4UTRzhpvSFmWdMrhJHT+K5NcRnxRVv3MzWZKWfYY/CVL/9QLynSw/SvjX80 Mh+iJ/t1YMQXV6dj3TdE732wFF1l4FrTR+qSMrq/f1GjYQ7e+5oi6jNCSjjosSVlcppN hMmYRZOvbLAfFIGIl2eC87OSqBcPjvpemQ3dkYOJ9ZOSfWH48CxbSSBqDLSaH3gd7ubU x/nhT+bQCBCT1JPfywJBKR7BZ/o65O6qJYfI+lnZ1WURhlrUbSqF2lIi+5TRo8LS7dHB 9DjbCJCjSETq1lHtlExSbEEZzPpjp70XN1h/8RX2lYsFWrVNCtxC1IHjeTvdbhqM9nQn UuLw== 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=LQyFPhZ4TdxabsAQC7tB7VpjsBJo12REYjzJQquzNGc=; b=HW0Vm5rCP9clF82r9yNQLNkDW6QcZEwoasNEPmOqXMY11ik9dn1+7Hfymb1FaGZxsW eYuNUS3dDFYaHEjlJcDqC6lAOFpAo27EcwrAFqsytJZJNjiGynZz7dc4Bsf3DAJF27NX TPANjsEBz64Na/ZSOaSvmXlQErfcEutaJDSPfUGaBbm/MN8+/Y1Cnx869KpyWi3v2Ih1 I2VPcBeGnuf5cmGjjAV3zLOju4Ml6FlKG5MqT3zKpmGIi7A919kqoAGFYkqEPqAW31sz TENBy5JlAdgDd9IfeQA+o0kmD0Pr+HHftgY9Sfd8QJmPrIwsf4bcAYgw/0cmw3O0JjFz DuBA== 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 p14-20020a170902e74e00b001ab0727a2c0si5225093plf.424.2023.06.05.00.12.38; Mon, 05 Jun 2023 00:12:49 -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 S230346AbjFEHCU (ORCPT + 99 others); Mon, 5 Jun 2023 03:02:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjFEHCI (ORCPT ); Mon, 5 Jun 2023 03:02:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF06119A; Mon, 5 Jun 2023 00:01:50 -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 396EED75; Mon, 5 Jun 2023 00:02:36 -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 E92E03F793; Mon, 5 Jun 2023 00:01:48 -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 07/27] locking/atomic: hexagon: add preprocessor symbols Date: Mon, 5 Jun 2023 08:01:04 +0100 Message-Id: <20230605070124.3741859-8-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 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?1767845837054559947?= X-GMAIL-MSGID: =?utf-8?q?1767845837054559947?= 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/hexagon. Signed-off-by: Mark Rutland Reviewed-by: Kees Cook Cc: Boqun Feng Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Will Deacon --- arch/hexagon/include/asm/atomic.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h index ad6c111e9c10f..5c8440016c762 100644 --- a/arch/hexagon/include/asm/atomic.h +++ b/arch/hexagon/include/asm/atomic.h @@ -91,6 +91,11 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \ ATOMIC_OPS(add) ATOMIC_OPS(sub) +#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 + #undef ATOMIC_OPS #define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) @@ -98,6 +103,10 @@ ATOMIC_OPS(and) ATOMIC_OPS(or) ATOMIC_OPS(xor) +#define arch_atomic_fetch_and arch_atomic_fetch_and +#define arch_atomic_fetch_or arch_atomic_fetch_or +#define arch_atomic_fetch_xor arch_atomic_fetch_xor + #undef ATOMIC_OPS #undef ATOMIC_FETCH_OP #undef ATOMIC_OP_RETURN