Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp246458lqb; Tue, 4 Jun 2024 10:05:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5ar/GnD1esAzcBQb2rDG1RbYhoL1c8XaiaRGhZvZCV7/AXkHRwe32R22Xgb3i8wqlngPXbijIQ8fL40+2GPOCWImfmGW1BXWHx88Gcw== X-Google-Smtp-Source: AGHT+IH+pgdj6r5O3qxamOw83lZYbznHZDCYKypP10T9UZYXFqnlt/pOxaLsSJwxO5E3r0hx6njV X-Received: by 2002:a17:903:228c:b0:1f6:5e40:6e22 with SMTP id d9443c01a7336-1f6937bce7fmr50334755ad.9.1717520713472; Tue, 04 Jun 2024 10:05:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717520713; cv=pass; d=google.com; s=arc-20160816; b=XOuyGNAs9fJbUifCgvXbAwag64V28FHR+/3C2AiHmRpamcxHEVNQ14qlpqYTNH9foo VC10Oh2ySkdoFS3bO6I324syCpY35o46Jqf9+w+WPGHvgEYgP6p1SurRySMm5QnjA184 wewequX6kFkJHdsajWpf343tU9bQk6XPho4Eg+fqauBuAavXWV1aV1jdisj00JesJuJ0 x3spX1utOOdag/BmtWz1DpXBibz1WogvdVF/zNJilx2GftD9RSmpMjd1Lz6bTqf1Wi9v d1goO6COSyZJyOdHrSJYKqohOqs6KlMV8KxXEUo8VN8KycbWGD79A4vxjSHdfZF34En+ EW8w== 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=q8ZLyU8rFmCfX/MuxxgYxeHsZIdPMeuwOTx8qf41nFo=; fh=/cpz1893jIenImITBEfJCw3jS9mafgA1DkEVfdws238=; b=xesBgWnyBetJV2+EJQVUJgCYrP8Oq7YVklQ7sUbe3GupMyq5KLN5xd/HbsQ8a9QGNz saV4Wd7NlixmTZM6B/0m22ox/EZuxWW9AyE8zy1z6ys6PUmDNCSkvQUGvMuY+pNF5UEU dwNGZKss4U1kCAbJkm7/tLmuE55UK3vm4TAW7kjnQ7J3nEaokpjo6dtjDMrOq3LUCt51 VtukF9FvyItiPkBStZ8A7apvY7deIegsniyB60wA6ONqXVWb7o20sA4Jpij1FNL66mr8 QuB0eftZ6hqm4DNMLgZagXAyiFgUTKrnfWy4jbmUzLOHpTCWMU8KEWr6NbMR7VloOxtW WwAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqARKUI5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201122-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f65e4274aesi16979255ad.521.2024.06.04.10.05.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 10:05:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqARKUI5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201122-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201122-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 88E4D28311A for ; Tue, 4 Jun 2024 17:05:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF11914A093; Tue, 4 Jun 2024 17:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nqARKUI5" 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 BF530149C67; Tue, 4 Jun 2024 17:04:41 +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=1717520681; cv=none; b=mS74vz6dVacpUlDVLFb7fsGftHFvXyJWPVPqXghlAfbGeNThPmAsLi2r6qc8qucDwIiKBsQqDKn7BhuC+Q8Cu/36+9dLsq5lzqDJo4sk4LdSwT765af5mdejQHHlULwfLtFvoFxF3eIqAmPtkT5cFUBkyY62gpmHb3fx9yePxbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717520681; c=relaxed/simple; bh=GxwVGSclRaGU/SB3ndBiNvXG+9cagR1RsASsFKDZ6S8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SxXhyTkx/gcH6SAf85SLUhIII8u9Q+D/U0W9BqhJQnj3uMvNtH53qLGoekly1jYLhNzTxmCGCpz+9KkFApuDWkWs7rZUKbOW+X0/qyXNr2rKCyS8U8Wu5dZpG4Wv/fUI+StFrWibO6Hwj6Hlo2KXPFNhKAyRCkog5a11Qy8CtUg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nqARKUI5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 618BAC4AF0A; Tue, 4 Jun 2024 17:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717520681; bh=GxwVGSclRaGU/SB3ndBiNvXG+9cagR1RsASsFKDZ6S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nqARKUI5XSSx7SeFDFVZhhnMd+v9cxXbud2egrU5rqUpu7Wn0aByJNTBInYwpf6eb BGYqKqkybmoZ3Zxf7lwKE7jJt7yvxAAJSMd16HpbM0pzyxZibSZrsAfBY/lq0bJ0Qj QcAUkc7hjloPQywj1HvHXDmNbqs8TDqSP3ImoJ8OXA+A8A6RQ8HbnzABAeLWOcMNPN 8eybIErJI5kSK3Jb3EkwlZDhSUlOHeKd5fX3mjYA9vVYw1+PsX+7YAI9ToqjT7JIDN /MJp1R8HZ944N/61tin46cQ3bOSGrNi9dm9CcZ9LzDIrEF+MVNpb0QgsjR4ipjrG1U VWwGUON4u80Fw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 01CFFCE1415; Tue, 4 Jun 2024 10:04:41 -0700 (PDT) From: "Paul E. McKenney" To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, elver@google.com, akpm@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, dianders@chromium.org, pmladek@suse.com, torvalds@linux-foundation.org, arnd@arndb.de, "Paul E. McKenney" , Andi Shyti , Palmer Dabbelt , Masami Hiramatsu , linux-sh@vger.kernel.org Subject: [PATCH v3 cmpxchg 2/4] sh: Emulate one-byte cmpxchg Date: Tue, 4 Jun 2024 10:04:35 -0700 Message-Id: <20240604170437.2362545-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <1dee481f-d584-41d6-a5f1-d84375be5fe8@paulmck-laptop> References: <1dee481f-d584-41d6-a5f1-d84375be5fe8@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. ] [ 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 5e6a3ead51fb1..f723e2256c9c1 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