Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5245059rwd; Mon, 5 Jun 2023 00:08:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jf1ih7I1k+5v3l3esBjE0R91M+MduHA3QFm255u21EFDdh9fpdnP3duk8f3f8jHcj1kFD X-Received: by 2002:a05:6a00:3a29:b0:656:6d18:3d83 with SMTP id fj41-20020a056a003a2900b006566d183d83mr2351211pfb.7.1685948892724; Mon, 05 Jun 2023 00:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685948892; cv=none; d=google.com; s=arc-20160816; b=JfUQu3+6nQIPtxKkdK3w64mz1QMf73CaxygoNpu1lxvd5sf6HlG/aZqxCTxb2JOTg6 uJP8Lrfn2fVVE1IOtNCrxMyqxmENYscNM+MPuj23RbNT5uCN7lkKs2Zw6AbOTpH9GlgH VqYZyIThizSsWhlN057/fxMIhD5wI6z3p3wHnHr8JuaXF8tHIeqXRFHE4VnxXEbpneTr bxISEujKSJimx7rQHh8OHBFeoCIxe6yatt0RI9iwuNHhKtplNfaLxCVmQyk+P50jYypi n9px3f38sM4rnXtDqFTt80tCN8qIO4Qs9LadmOvdc23ngyBWL+GrEV0OmWuBLwWBKoDJ WMpA== 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=eUFgnstRV5mcGy9wrNjoeGVtbBqSl0l/AQyxZMhGU84=; b=M2N6bkURrtd1LxYebm9wJF0z0auMTwg4z66YkgaEqjwZcxcMRwDkfPyutvlgSXYL33 hOXHxCTWWiS4deTJtmGsRnQDMMLdg5YPyU6HZUTevoMVEESN5Rh6prtjk6esR4DyyhMP sIFu3YP5Vp9WDp3v9UkaR+ajC/u6WnzJCn/LP/oMNiZAS2p48jMw7Ji3fevNjb37Wiye AVfmQvkvZL5pIvXjDuINNUQrLPSjojo6cY22R3+Dkf1fZ31mp+agBA4W3K1V2kGGWNLs MALXz+43JygtEpL/Ecf9fZLs/hnuE1yw/trpnUbUZZPQqdtY7M2n8EMskAHJ/IMEqzr4 qqfQ== 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 b129-20020a633487000000b0053fb1fbd3f7si5012529pga.350.2023.06.05.00.08.00; Mon, 05 Jun 2023 00:08:12 -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 S230287AbjFEHDF (ORCPT + 99 others); Mon, 5 Jun 2023 03:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbjFEHCb (ORCPT ); Mon, 5 Jun 2023 03:02:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F6CB10DB; Mon, 5 Jun 2023 00:02:06 -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 A47511650; Mon, 5 Jun 2023 00:02:51 -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 5FFBB3F793; Mon, 5 Jun 2023 00:02:04 -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 13/27] locking/atomic: xtensa: add preprocessor symbols Date: Mon, 5 Jun 2023 08:01:10 +0100 Message-Id: <20230605070124.3741859-14-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/xtensa. Signed-off-by: Mark Rutland Reviewed-by: Kees Cook Cc: Boqun Feng Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Will Deacon --- arch/xtensa/include/asm/atomic.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h index 1d323a864002c..7308b7f777d79 100644 --- a/arch/xtensa/include/asm/atomic.h +++ b/arch/xtensa/include/asm/atomic.h @@ -245,6 +245,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) @@ -252,6 +257,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 -- 2.30.2