From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26092CA600A for ; Wed, 7 Oct 2026 20:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4m4X0icEY5wLbcxkq/NyT5iheFGc0KuuGSEu/blipgE=; b=jHomqj8epnINAQ VKIXMo67aB12e4LOfrajmpzQiO0j7uV84vwRtf34xV17QDEhOuS0wLy07Zl6cQUi1K0SyJIBf4EPq iU6zGC3h7DAM+t0EogKwNfgx06r6iICZ0+wMC+08iFTMUGD9dW3VWLh1LSGRcSwNEcPAwOLFcx5nA 9Zv1srrRHN+TN1QsT/etQ7CyF9oMxGiNtEkf7lPve4FCw9ZLm3lGV/9ucmZ4VbssgLM1mGIyFG4jq bCRJtoaJd5if8J+4Jp0kPSByDJElTj9ve3R1/2WoGSwgFaQf/3ocoXIFrWH9pWJyPZvLPDfmwNJgr aqPQKzKuhZCXA5ISZXfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xEYNT-000000038qB-2aWt; Wed, 07 Oct 2026 20:36:39 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xEYNS-000000038pJ-1MBX for linux-snps-arc@lists.infradead.org; Wed, 07 Oct 2026 20:36:38 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id E721143835; Wed, 7 Oct 2026 20:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B99EE1F0089C; Wed, 7 Oct 2026 20:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791405397; bh=upIye1vBByZq8u9I7ewvweyxNsW1uHQn3v6eHNja+6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Eaprc0SxvCsFv6ngGQs+vgo/PT/Vo2xHgN3DA6sHitMW8/Z5UJuSLWAcaOTdrl3se 3Eo1KEVdR5/l5hekbHimkZEdU9JpRhJMXButNWBNNVacCMCZw5JBmujXDq4W32sjeI oztaqjcIxWdaQ9YU8KEnlx1CC6gyw/se01qOCtk4mnSc8iytAZXUtyxvtKH3qPsJ+t AMYUtOSDbdTILWuqsfya+74CVLCrsLx3MlcR243lLb3d+/IxMdpwWA+8f0jtvbRHfv byhOu2u77TttTGI+upIPDPHwINLgPA7BjceFKJ1xoumKW/6RnM1ILelqqJWlfJRhOg kJOCxj0xAKFHg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 6666BCE1735; Wed, 7 Oct 2026 13:36:37 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: Bradley Morgan , Vineet Gupta , Guo Ren , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Chris Zankel , Max Filippov , Andrew Morton , Arnd Bergmann , David Laight , linux-snps-arc@lists.infradead.org, linux-csky@vger.kernel.org, linux-sh@vger.kernel.org, kernel-team@meta.com, "Paul E . McKenney" Subject: [PATCH 3/5] ARC: Emulate two-byte cmpxchg Date: Wed, 7 Oct 2026 13:36:34 -0700 Message-Id: <20261007203636.1982188-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <7f398d4a-7fae-4382-9cc4-8627e8aa912b@paulmck-laptop> References: <7f398d4a-7fae-4382-9cc4-8627e8aa912b@paulmck-laptop> MIME-Version: 1.0 X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org From: Bradley Morgan ARC has no two-byte atomic compare and swap, so the arch_cmpxchg_relaxed() macro switch lets case 2 fall through to BUILD_BUG() via default, and a two-byte cmpxchg() fails the build. Route case 2 through the new cmpxchg_emu_u16(), which narrows the old and new values itself, so the dispatch keeps the (uintptr_t) casts the case 1 path already uses. The sizeof(*(_p_)) fix that v4 folded in here landed separately through Vineet's f050c3e61d2a, so this patch is now only the case 2 wiring. Signed-off-by: Bradley Morgan Signed-off-by: Paul E. McKenney --- arch/arc/include/asm/cmpxchg.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h index 76f43db0890fc..7157718f147c1 100644 --- a/arch/arc/include/asm/cmpxchg.h +++ b/arch/arc/include/asm/cmpxchg.h @@ -50,6 +50,9 @@ case 1: \ _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_); \ break; \ + case 2: \ + _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *__force)_p_, (unsigned long)_o_, (unsigned long)_n_); \ + break; \ case 4: \ _prev_ = __cmpxchg(_p_, _o_, _n_); \ break; \ -- 2.40.1 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc