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 33ECBCA5FFF 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=e4JoKzSPw1ZAEoq+MBSVx+CZI05Tkv15xv0MojEVHMA=; b=doWB6oqj+1Zli7 zvPG+7x7VbvBovhkeort+dMsTR388sihtCdT3JAkU2rqlbD28eRw8HDSpGW+aaSPWQ3tEOUEigTM/ iwJz0i0v1fwN4SspVHSHT4cyS0DcCIX1cZUK/YG5KsHmPw+YbpAJs6HWiuqn0MYUXzzIRycsa7bpF yfK20H0y2vj3lY/0RLByAKjQZUihkmSRfGjKg52tTQpk7oJmlcKY9UWUbod9xT/ZQGO/GnPoQq5Fh HEU54xED9c/QWOwK8r+qNPmm3bExVg0KO+1Uab35eF0saFt6GflaAsfyRGwUddR9AGdyH3in56FZr XGfYGyjeX1HAvyqifHIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xEYNT-000000038qL-3ctw; Wed, 07 Oct 2026 20:36:39 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xEYNS-000000038pN-1kQm 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 F3A61447CE; Wed, 7 Oct 2026 20:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C64551F0089E; 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=GTffbaoiVvRePJUrsdmv7S1xtr+0/6F7pccxHu/PeBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jXbODRQamIQ0FFBocApZWXP2HYnebX+irIL0ajT4d94EIw5gkO2dIUYcewqp3ztag +8Zgsr1nANqc3jnS+tFqisNgxHfvYv1/5o2upFlixZp50zBXuMVSe3IBCfxNb4abXO lJMBFC7qx5GRVKVgKs+i99f58+h21twgsLa8/wubOImK0eYRGiy3IbSwWz19BdefZE yMYbjul8pVUwkPM49WcE+nfSjS9SKaWJKcNULb58D2d07SzyYceJcsHzslgubYSwy0 dIC+Au7bA6nau7WWp5AL66AhbXj+QwB6eiqnOzsH1zRUgOXETFHeziSLNcG0RIfONT 8ZIlo355idolA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 69A03CE1DC2; 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 4/5] csky: Emulate two-byte cmpxchg Date: Wed, 7 Oct 2026 13:36:35 -0700 Message-Id: <20261007203636.1982188-4-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 C-SKY has no two-byte atomic compare and swap, so the __cmpxchg() macros let 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 all three orderings, relaxed, acquire and full, keep the (uintptr_t) casts the case 1 path already uses. Signed-off-by: Bradley Morgan Signed-off-by: Paul E. McKenney --- arch/csky/include/asm/cmpxchg.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/csky/include/asm/cmpxchg.h b/arch/csky/include/asm/cmpxchg.h index db6dda47184e4..6f3ca79e54acf 100644 --- a/arch/csky/include/asm/cmpxchg.h +++ b/arch/csky/include/asm/cmpxchg.h @@ -64,6 +64,9 @@ switch (size) { \ case 1: \ __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ + break; \ + case 2: \ + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (unsigned long)__old, (unsigned long)__new); \ break; \ case 4: \ asm volatile ( \ @@ -97,6 +100,9 @@ switch (size) { \ case 1: \ __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ + break; \ + case 2: \ + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (unsigned long)__old, (unsigned long)__new); \ break; \ case 4: \ asm volatile ( \ @@ -131,6 +137,9 @@ switch (size) { \ case 1: \ __ret = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)__ptr, (uintptr_t)__old, (uintptr_t)__new); \ + break; \ + case 2: \ + __ret = (__typeof__(*(ptr)))cmpxchg_emu_u16((volatile u16 *)__ptr, (unsigned long)__old, (unsigned long)__new); \ break; \ case 4: \ asm volatile ( \ -- 2.40.1 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc