Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1510071lqe; Mon, 8 Apr 2024 10:52:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpdZztYMBweD9qXatN2B9E40tptfDbarfQzC+YKgCEHfBYRiFyPvXL/inKeRHB4y3fF4xd4x2UIEHGiakIV0R4ZytGkq48zftQSpR8YA== X-Google-Smtp-Source: AGHT+IEXfCsAOFc2QLrB/uwA/NfaQ50Cn0Jr7KB1f0/4xk5YTQ1GuQq5yTFzzJUHcD7Zstlwtmk+ X-Received: by 2002:a05:620a:1a1c:b0:78d:6069:91f3 with SMTP id bk28-20020a05620a1a1c00b0078d606991f3mr7471407qkb.57.1712598725361; Mon, 08 Apr 2024 10:52:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712598725; cv=pass; d=google.com; s=arc-20160816; b=otXSgq6MvqVl32X/9xImXsai5zbQG9rp4gu2Upf5D4kWjvJlw0xVc/MIhQ4RGR5rO0 2sOeJ3gTCyLq7uK/KDnQAOKm00zVlEOJr3zBN+FgYe2ceQLt2zBbeY9X+IFWyZ5DT7Vf mhSGXp1hY5NjMBdoSSri8YTzWgn2tRmug7Osbv275kpxrA017IzYmtwxxmuRWNwc5Piz WK2Joz7dinJqFiCsMF17JGRfUX5MArX2WrKgCgoANEmUo4pTNnAzQPAvmJUaSFQLWxrz Zt6ab/B+JXv77xDIwsI1xOntZYBzgxKymMc/fgWQlXxNsalRDgA8O+tsWHuWK7VEXwb/ KvkA== 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=E/kn+VSBsi5bHvHZDqWdsQooKNFa+YyDFvM78qO2Yq8=; fh=XGQUof9B8a6pTwahA+flQfK1ARTfs/THrHL06KmjawQ=; b=E8/0gCHcMUnmVdi3egg0wg+Sp6fuq28ML7dXSrJqzbwY/eby4qbNw6YHFqESZLqOym VkSus85c2mErhI8priibS9ZmtCWCKU7j99YHWCMt38CLjfvi3Zpot40NxZfvCqJJf5+c 4cUXV4YrmGdzK1q+hbjh2FWBkCe4Ybfglo+O27UjMRs9oS5i+E/advr3fyaQ4U1Ycukl g3YpNpokIzh3u2YJapdYcMy/aprT+ZiaUMZojKqCka9kHzA/zNPawLQcCUYhqsnocl55 GL6fe57FVBMI91r6Gg/96sXGEv8Rx12Rmj3gSOr13RbnCnudeYYNZSFQhIMfw9iHNqQc HOZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AyTIZnDM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135779-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135779-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dy8-20020a05620a60c800b0078bc225f5b0si8582505qkb.93.2024.04.08.10.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135779-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AyTIZnDM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135779-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135779-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 19F9D1C239BF for ; Mon, 8 Apr 2024 17:52:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2259E1487DB; Mon, 8 Apr 2024 17:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AyTIZnDM" 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 4E7031448D4; Mon, 8 Apr 2024 17:49:47 +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=1712598587; cv=none; b=alCk//doUX8KQZNDnAqbEcNJHzYN8ijQI2HpZRZRxEx1SHXQr200dEtPRk9T+VnW7f9g03iDOEM/M6EPT7gEYEWf4mgfxtN4xagF/BCvr80TNqWsoNXHETKIsCvjjmnogM0EyJF8XVCw7OWOuTPHw6l1YOT2LWW9ud7bvANtX9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712598587; c=relaxed/simple; bh=CsdoBFIa1iUKUh43LG7ixotspstLiAd1X2CXa4pgxHQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cBuorKHF+BnrFXEsjf+iHga+nrhNcPccNwxkFeFMR+zW131f4pGW6qrdXMw+zbKphsfnbhRjHtef616efsiHnWp8mFK2V3ajqi0F14FwI4PJ+1n4MDa/nsAYEbyL+zVG8iwLE/lA0GNDsoveQzYzogx5ETGHcc7GAZcgsFaNKpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AyTIZnDM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FADFC41679; Mon, 8 Apr 2024 17:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712598587; bh=CsdoBFIa1iUKUh43LG7ixotspstLiAd1X2CXa4pgxHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AyTIZnDMdDNdEeZd8JhwXdayK4jqjWb/AQJ8n1boadxn4LgqbDKQFSVuvoL3FSTaz qufXEp960YoUMK16/1hEBbFzCtUaOyca/liTZ/vOKRLCBiAoTKdMYuaDyHf32V5ADl V25qgGiNzd2YB7+a/YPPYHq+Fm6IdNBjj7GtQhiXB+HetnLq779PjU/YCUCt77Bu0t kkaG9fRdkygxlehPmmMHYpuO60oDnJAwNg1FWJ8SqIIJnlZ3vWAO2A/Gyv+QzsnD4v fal812wQxjsFRlwCqcp31MJqDy8EmTATfV6WZb6rAjwHvkJglbJ0wMrdcDQC3i6Ss9 +NBhEFKZzW+5g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5A71FCE2CD9; Mon, 8 Apr 2024 10:49:46 -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, torvalds@linux-foundation.org, Arnd Bergmann , "Paul E. McKenney" , Andi Shyti , Palmer Dabbelt , Masami Hiramatsu , linux-sh@vger.kernel.org Subject: [PATCH cmpxchg 12/14] sh: Emulate one-byte cmpxchg Date: Mon, 8 Apr 2024 10:49:42 -0700 Message-Id: <20240408174944.907695-12-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <7b3646e0-667c-48e2-8f09-e493c43c30cb@paulmck-laptop> References: <7b3646e0-667c-48e2-8f09-e493c43c30cb@paulmck-laptop> 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. ] 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 | 2 ++ 2 files changed, 3 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..27a9040983cfe 100644 --- a/arch/sh/include/asm/cmpxchg.h +++ b/arch/sh/include/asm/cmpxchg.h @@ -56,6 +56,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((volatile u8 *)ptr, old, new); case 4: return __cmpxchg_u32(ptr, old, new); } -- 2.40.1