Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp780281lqm; Wed, 1 May 2024 16:03:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCKeVq0KU0wxEdwEd/+OxFpiy/V04pPcOQ5Eh/UJoExMig0wpVdpix3T4bpO8dHNA1HQqsoDn7+B/cIpEOEU1yHJ4e5T78QBDLlHThRw== X-Google-Smtp-Source: AGHT+IHNcsw2qTpWzbjvW+S/74ndLGLRXATljMM2MI+BUz4v6N219+ezBpuRP9JuTG5fuPP0xQCy X-Received: by 2002:a05:6214:d88:b0:6a0:a76b:e216 with SMTP id e8-20020a0562140d8800b006a0a76be216mr3647247qve.13.1714604588860; Wed, 01 May 2024 16:03:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714604588; cv=pass; d=google.com; s=arc-20160816; b=vJbk50Xbg/wCnh1EzZQ4ObAoLCZWkh7fZhdjl+TjmfRIhMYiINOalhVGxz/lPumZi5 k0HT1XJ5cKck00JrxSs9amjwhHcfzo5Btuegy/Ax8uFe1kusNVE9i2GGOiVD5tL46q/8 EkLczrcJkSZbrwiZ4ICNDuE1UkkyjcVwz/7Zy3UOfF/AaYWDil6VdWeRFc2uJRUKXq+8 zapgWVBzDsbVH9dHt99xb0zHH0UEwg2+GB+jRlx2lfUjJgFRTV5ywZzQ1En2r5svXB7y jnF6HeX11hh2zEvFGTSv32xfc6NWkL4h/Fizf96qcmkCuSsgqsXW/PKhYYBHQmX5m63I +dPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2ZpL2ezpg6zVKfROH8w2EK+SxOkaPY5z6y3tLdNon4c=; fh=zS8h4h7OSvmJV/JgSQET0yWAFXiVjEXGZRQxAiPfuLA=; b=T/ovoG9amFJ7OoBOMD9Bbm78RGVfBwUJ8pLiHSKwWk0bVvAofuuOX2dCJzb45gIWCp E0RdKu7yeToJW+nWIEhc4yrxZUKjYfCXrry7CtwY6/r+ucVfNhy0bDe7L/r1Fd0QZr6Y X6vdJjUvIAxj5aIZjkyIDX6IBMJJDgv70HudJB3BsmAODcrYeK3q2Z4qc73Kt63nkr1E SSw6PijThJrm06yP4bzA1Wcnna9kQZJrSC7keDGKsSixhe061pfm1IAEd1tuiQO0oqQG Ojc4aCCZc97ntD5JGVPIgKRJlHi2kzRAXZyPAu8F0qc2kmDtPfUE34oWGGhWu9KeQLcD nVtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=udk4pKYq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ey1-20020a0562140b6100b006a0cb03b364si8721886qvb.166.2024.05.01.16.03.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 16:03:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=udk4pKYq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-165811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 958A11C2148F for ; Wed, 1 May 2024 23:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9BFE16DEB5; Wed, 1 May 2024 23:01:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="udk4pKYq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31477168B10; Wed, 1 May 2024 23:01:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714604493; cv=none; b=ESw3IBFe0L6VyFb+JpevCuAggcCs0RowuYtH2bLoo/Tbipfam5b5ZUoUYAOYVR5QOj4jOr7+wyf3X9fFNQf8JrcRTbvL+4i26d7O4w0ujjkhWsUqRk+MBe7YG5AV23pcaXWqNDvg/YnX+H62I4RtZPQ0RO7rarH4Qu0ASJ5exXQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714604493; c=relaxed/simple; bh=PpSTQpZbHQunQSUzzPQvUIJ+CP30HDC9CfjkaUYmrk4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eaGLkvhzKPB+P9gI7SM71TMpys8ER/wPvXiUQZcdV72AcUXmv65EBqdyQpakM2DT+Qm6CzN/mMZG1Sn+W1xZaS3cTrOpiR3vY5Caw29AROX2Vog+cp1hwi3j+Kr9rOvRuvogfgB4WbGU0VZLjgefB6vPUJnSUFUps79tJXLBcnY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=udk4pKYq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC62FC4AF63; Wed, 1 May 2024 23:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714604492; bh=PpSTQpZbHQunQSUzzPQvUIJ+CP30HDC9CfjkaUYmrk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udk4pKYqRq0ueXXLHSRjrkKMd/zpUR+9miHTot+JmCll3YBJkGiBLy86jszq+qFzF GeiObNB8nitkHY1DOg59JDhvvnvfgvAlFcK0cjZqjpZ/ssuPrnPX606CQdDWYZA9vm ONxY1yJYUndEIBYXfeTXWQQYDUw79U1RTnQDHrE3HBeEN5D2Yh4dVy5ZnfXIHoTenM tVSKIczrGG7Zg4rkoYiLRrVdBAN2aYxyZiKsbOGqpPEQMk5hRz6G23DnMoepDRx0me ZhR/DNTlAzRfa6sR+giejx0/bFLv/kZQfz865i0CFh/ldfTHdBFcL3zRfpLmXyCB1T XVsxhkv6E0z/g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id DCFFECE2A4B; Wed, 1 May 2024 16:01:31 -0700 (PDT) From: "Paul E. McKenney" To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: elver@google.com, akpm@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, dianders@chromium.org, pmladek@suse.com, arnd@arndb.de, torvalds@linux-foundation.org, kernel-team@meta.com, "Paul E. McKenney" , Andi Shyti , Palmer Dabbelt , Masami Hiramatsu , linux-sh@vger.kernel.org Subject: [PATCH v2 cmpxchg 12/13] sh: Emulate one-byte cmpxchg Date: Wed, 1 May 2024 16:01:29 -0700 Message-Id: <20240501230130.1111603-12-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on sh. [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] [ paulmck: Apply feedback from Naresh Kamboju. ] [ Apply Geert Uytterhoeven feedback. ] Signed-off-by: Paul E. McKenney Cc: Andi Shyti Cc: Palmer Dabbelt Cc: Masami Hiramatsu Cc: Arnd Bergmann Cc: --- arch/sh/Kconfig | 1 + arch/sh/include/asm/cmpxchg.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 2ad3e29f0ebec..f47e9ccf4efd2 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -16,6 +16,7 @@ config SUPERH select ARCH_HIBERNATION_POSSIBLE if MMU select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_NEED_CMPXCHG_1_EMU select CPU_NO_EFFICIENT_FFS select DMA_DECLARE_COHERENT select GENERIC_ATOMIC64 diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.h index 5d617b3ef78f7..1e5dc5ccf7bf5 100644 --- a/arch/sh/include/asm/cmpxchg.h +++ b/arch/sh/include/asm/cmpxchg.h @@ -9,6 +9,7 @@ #include #include +#include #if defined(CONFIG_GUSA_RB) #include @@ -56,6 +57,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, unsigned long new, int size) { switch (size) { + case 1: + return cmpxchg_emu_u8(ptr, old, new); case 4: return __cmpxchg_u32(ptr, old, new); } -- 2.40.1