Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1510129lqe; Mon, 8 Apr 2024 10:52:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUuuLc6mZtOMoURsDTmzUn/O9pB78qPVjYs3fSIAKm2A2hlTkCQCEZlgyik+Mtvg1hpeAqLWqWxXg5sxvVeFOq+FSIYLLgVgUq0SLu6lA== X-Google-Smtp-Source: AGHT+IG6eT3BG4xf0W5nUGmAw04eXqAGnUPciQbwIEVGQ477XQ9c+r77cNzVt5noGK2J6xbXpbpG X-Received: by 2002:a05:6902:1005:b0:dcb:ce4a:bc2b with SMTP id w5-20020a056902100500b00dcbce4abc2bmr9013964ybt.51.1712598731805; Mon, 08 Apr 2024 10:52:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712598731; cv=pass; d=google.com; s=arc-20160816; b=qisgsaHUvLdbz1PTh7BpQpBjDq/HSY8dGJKmTB07HmT7scTMkdmqV2O+k8w3q/dC2Y Rs+4mIj3E1A/HO7hJ8iF034pyw17NL37fFvx3OcFxPIKsOP8s7yU1Epcv5faR4nXD26X FXNktaLhDF/Cmn5vYgDWEygm6FJBVVGwyGE0QiSfrdcJttfTuE4xiPai2GMdx3j/k54K Ifuiy8Q9uY7+dVRviGhJT45+hxkqNKWUEoIkXiioKSwV/YrtDiCGhtkvVGme3VgpFfGV qeBjQE6Q4solC2snmTIoT94t0lIpRoSvgxgJkT1CXUmS36vCVvcGttQSZTnPI9GcgO/q r4Bw== 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=U6msz8YatFUsN6m5fyVV+LldAEkiwV8bdECN+Xgh6nQ=; fh=+OeL4Tsg+xzU0qaFQACoQl0ZbTsfU2uHcidlYHa+Lwg=; b=LxMJa4Nd6gyB/T90ukH7wUVrH4JhFtpuIbt2Q+h1/mvBJPhFxUAx1lMnYF8ds3shaV WHk/5ac5ZMD8v2IdkSEMMGvp+Kjb1TgzcaDFU3/PjGWEDDztbDizwUxoSkW3dvw+9xGH uE2H/j7g/NX3oAtJ69OipfsYG8kFuApgxQHfL6d8ISJI/X3Hk5kR9volfekBPy1m7AJs np0L2PzukdDqZ8kXlPmvaUEPb2zmmQsSyt6h6WqrZN4Lmd7mrPCOr9l41SyOUOVJkgvX dyp7IQT5cpqZdiYte1K8AS5Pf+lBwbbLV56AX2vO2tbRepFT/DM2SmF5RmG62gCQomFx LYRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KmluJ250; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135781-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 t6-20020a0cf986000000b0069b140e702asi3975562qvn.386.2024.04.08.10.52.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135781-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=KmluJ250; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135781-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 886281C239A0 for ; Mon, 8 Apr 2024 17:52:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 498DC148820; 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="KmluJ250" 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 6B1D81448E6; 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=OyiyfGDhPKDKqELKRco6kKtcBFWd5YiRMQibbwWXxdfWO3QMXYy5Jr82bKB4bn9tmezndk/d3VN7JMfneprqJIOwHrYBrf/mu5QjLmeT/+5hElqDP9eEEB2mqzCP7Be5pKELGivNORRKVKggtvk6vF2sHligKI7CxJz44+0NlyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712598587; c=relaxed/simple; bh=j8VRWv8f9Z0TI0OKN9Nqc6b3Iz1YHbxZqEB3CA0Ino0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jpuP8cd/rQIdcalY+gcN1UXzn0R5UhKOBgQUD29bEb9IQ4GKSrgj3as3ieNfo2l+z9/HPZIegb9mQGZevmHwC+9sakVHfDKkc9I1rX0wfVq2GNgDYMbnM0gRhoysEF3rW/RI1kJMaD9b6uEdWyYXcoCHaJ+6QmF7ICJJG0jGFiU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KmluJ250; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20185C4167E; 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=j8VRWv8f9Z0TI0OKN9Nqc6b3Iz1YHbxZqEB3CA0Ino0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KmluJ250u1QOwV0yPhaSVHkYqwFzsHPbZmgrE/hnmhuYOXiw3eQItoSzoxtv4OXkm AaP6/CIuMiuf9CMITppcxlAF1cSxbAsmVn88bhe8A9XbGrstSPnk2fdvjH+rv+NOJp M8Fdze4jsAN92tMOIjfgJIlv4S/CekoPJS6dI4voSluN6gq+kruRTIBRicCohM0QIM OIg9e+hxNMONJkYc0KLRVP3qMTguUVw9TNN/PllZ9OPFES7/vW87EOXFQyPBczbXqV Ic71jRbckWFXd/ZEKKIxzuA7hzhMrMryeYEq3wNtWEBSeO4tKhoXugzzgVPImEdg73 wqQ8Px7uRf4XQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5D19BCE2CE0; 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" , Yujie Liu , Andi Shyti , Geert Uytterhoeven Subject: [PATCH cmpxchg 13/14] xtensa: Emulate one-byte cmpxchg Date: Mon, 8 Apr 2024 10:49:43 -0700 Message-Id: <20240408174944.907695-13-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 xtensa. [ paulmck: Apply kernel test robot feedback. ] [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] Signed-off-by: Paul E. McKenney Tested-by: Yujie Liu Cc: Andi Shyti Cc: Geert Uytterhoeven Cc: Arnd Bergmann Cc: "Peter Zijlstra (Intel)" --- arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/cmpxchg.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index f200a4ec044e6..d3db28f2f8110 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -14,6 +14,7 @@ config XTENSA select ARCH_HAS_DMA_SET_UNCACHED if MMU select ARCH_HAS_STRNCPY_FROM_USER if !KASAN select ARCH_HAS_STRNLEN_USER + select ARCH_NEED_CMPXCHG_1_EMU select ARCH_USE_MEMTEST select ARCH_USE_QUEUED_RWLOCKS select ARCH_USE_QUEUED_SPINLOCKS diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h index 675a11ea8de76..29f8f594d5592 100644 --- a/arch/xtensa/include/asm/cmpxchg.h +++ b/arch/xtensa/include/asm/cmpxchg.h @@ -15,6 +15,7 @@ #include #include +#include /* * cmpxchg @@ -74,6 +75,7 @@ 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); default: __cmpxchg_called_with_bad_pointer(); return old; -- 2.40.1