Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1703744lqz; Mon, 1 Apr 2024 14:40:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0kTUKQPzEtBjn7luzS9YBNpI1lvttbTPOHk9G8QeuHzmQs7edEU4lRaadRaiVs47LMxthqkn9Cvw/9crN2/J/fIlPqXfEDKSk8O37PA== X-Google-Smtp-Source: AGHT+IELAKhGxc1tn/syjZzdJdwHyaJZKaFRUznwrEJOFHhV6vxcook5p2ZzD/gL4LO0UCjfCdEg X-Received: by 2002:a05:6102:21ac:b0:478:61cf:1f92 with SMTP id i12-20020a05610221ac00b0047861cf1f92mr5428744vsb.12.1712007624192; Mon, 01 Apr 2024 14:40:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712007624; cv=pass; d=google.com; s=arc-20160816; b=hT8RoWjWh59kxkSxOweIV7yRAdgHiriAyYvvDdsF1t4y6KT7GWMFuNjBwoz3/Ohv+K P4S1dL5UecGlVYM6ryWM0humX9MpVWelsEqGCQ+ddwSsOKyh4Ayz0NImzPAHH2NLOHhk hW4OdRZZi8OZF1JGUT/WTiUhn0ODlAV3VewTJCVLrVLRZtz/bIsYcCE0NBpOUTT/Iw8T S/MwWwixUjHhLa7iCMDIbKQCozQypZUuKSqenYCEgG0nCvne3MhN/fmBeTsSf31ypYMZ L2fwWJDQx6tiaVCflA/+dWXFy/SyuPcSQ2iXhl45MxQp3qtU2x6fne2kkpqWrfO6oLPF X2/Q== 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=xbXw+mN56ssE2gmnc4Fqv7jSvsCFiqanDRYN88hVfSw=; fh=9FmnyH2CmTnYSRyFVDbPbFRCd27fh5+ppZDxP741E1E=; b=cR51zIEZanPnovjr4iPSG40F4pjYio9GVPV3XJZVRJOpLcKCO00TXppy2OJ4+ePGbK ebrq4rNM1JmpPITTFv8nSXPnHbJCpm6RzuR6s3PTE/K8roHFRA3k/N8awviq01jJ7hSF DZ6n/n84gO+tTzRdb/i5zSdwfYgCKNIL68OxFDbuVdKBizJZgJj6od3lYyijOZS2w8vT Yt1ok+/P7AyCBafJPjXGGHC4DrzgSFgKElsL+0lmZVo6Yq6pYXMq8LkrRD8nlSBpGzgK 4P+DPLER+z+o89Bqrjg2qkdqkvWz4Ys2yiK/MvkoomyVhNe6CutP95YZwZLMSCHL4zpL 7WSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WMIuRxBF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127093-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127093-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 ef10-20020a0562140a6a00b0069916256c56si329320qvb.576.2024.04.01.14.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 14:40:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127093-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=WMIuRxBF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127093-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127093-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 E431F1C21C10 for ; Mon, 1 Apr 2024 21:40:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3830E56B71; Mon, 1 Apr 2024 21:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WMIuRxBF" 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 536FD55C3B; Mon, 1 Apr 2024 21:39:55 +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=1712007595; cv=none; b=D+WE98tjQrWbqWlfnP7aVw/g7cv7BY6x6ouiyKMSUTgMA0tezb1xAVAtZaIC2mblKd2YEMbBjFZEkqMwIWdpZT01UoTpuMkau6ff9mvr4MhHppyYEEXlMZ2rDoXkZkNUqnL13rLluT3IMVQkStRONM0LCXR5HyDRh39Q3cD+Nw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712007595; c=relaxed/simple; bh=tz6SD2Mww8E4+R0q2v0WTL1Y7yCpZZWUXYJiKBI2ETk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m3HKvSzQV0ZdZZ7r57AjbdcOp3OTf+CcFcEuNg1GQoANi1hqGcYBBQuyPBTJwJFDjJDI0RQN9jCTrfxVNIF1HELi7uG3JWQUhqDhaoX1QeE+Py/lhDfgZCD6fw/HgTF920LktXH90qsV+66FND2N7B9AQWF8PMVTSs+rFTeMqnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WMIuRxBF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33564C433B2; Mon, 1 Apr 2024 21:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712007595; bh=tz6SD2Mww8E4+R0q2v0WTL1Y7yCpZZWUXYJiKBI2ETk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMIuRxBFlQY2FUMDKIZBJYahDw6AsGLigwwGSJoFHI3fcSx1OXczvoC8b+Cbkx09r 5nr6nq0QPHlGh6eBkUbqT7dHd4Gb80oz0O7UYpF8mIOT0LNdJF3jsFll8yzEGDzwLT X2bh3/ECmqLUWCHpXsM7bNsnmqH8Le4Z2dHITr7Mo6C+Q38O/Uj7Jw0nkDOodAFq7S 3JOW9fzL8+U8BEqjPb1dGmGZop+e620ZB75mpuI/4A4LT9Xh3aGnxkjj8iLzHdFfXm tw9aB5Ob5VUIcBGkhOPBvo9fwrWulYN4suPZYqRMbz/wGRYyIsEWcyv5xFoeti3D46 WaR+F3MG11fiQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id C573DCE0D0C; Mon, 1 Apr 2024 14:39:54 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: kernel-team@meta.com, "Paul E. McKenney" , Andi Shyti , Palmer Dabbelt , Masami Hiramatsu , linux-sh@vger.kernel.org Subject: [PATCH RFC cmpxchg 5/8] sh: Emulate one-byte and two-byte cmpxchg Date: Mon, 1 Apr 2024 14:39:47 -0700 Message-Id: <20240401213950.3910531-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <31c82dcc-e203-48a9-aadd-f2fcd57d94c1@paulmck-laptop> References: <31c82dcc-e203-48a9-aadd-f2fcd57d94c1@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() and cmpxchg_emu_u16() to emulate one-byte and two-byte cmpxchg() on sh. Signed-off-by: Paul E. McKenney Cc: Andi Shyti Cc: Palmer Dabbelt Cc: Masami Hiramatsu Cc: --- arch/sh/Kconfig | 1 + arch/sh/include/asm/cmpxchg.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 2ad3e29f0ebec..43a121c6ca0f3 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_2_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..18233cc14419e 100644 --- a/arch/sh/include/asm/cmpxchg.h +++ b/arch/sh/include/asm/cmpxchg.h @@ -56,6 +56,10 @@ 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 2: + return cmpxchg_emu_u16((volatile u16 *)ptr, old, new); case 4: return __cmpxchg_u32(ptr, old, new); } -- 2.40.1