Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1841583lqz; Mon, 1 Apr 2024 21:27:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmmSxH+CfGymY4L8tUB3nQ/o1Dy4OeXeGq/HAdlmYkf/M8fWI0tmQObrdgy9gQaewXbEg3ZdWnDIoo5Utttp1yEkHdkVydt5aEpWHltQ== X-Google-Smtp-Source: AGHT+IEYXGw/tiwU9qH4mQzUMscGx6QW7Duvjt+OzZVyPLug8c+sZqepX4oSEMIDcXpCJnP1iIpv X-Received: by 2002:a17:907:6d0a:b0:a4e:831b:5b80 with SMTP id sa10-20020a1709076d0a00b00a4e831b5b80mr982439ejc.30.1712032069393; Mon, 01 Apr 2024 21:27:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712032069; cv=pass; d=google.com; s=arc-20160816; b=ZhqJJGZilgP4F5vJ6cFC9tLiSVNefmRZWk7QW2tuKYdwmyvxzNJXLHgq9nLzcQadLa RA8zjY8MRnHpYeoviiuJldfeaKBOmbUyNQKsIRPkm0CdQ87yN10lyEybUludMdid/eBN wTZjJAYzs7Ek/Z5Uywpxdfvqwb+qVNilguaAOvv6zQCvwnspDes0NVvMl1zLkGC3X92f apz9qfM/iU2Qz/oMyQAomQYx/LS2eVs+I/uX9+XCeMZZNp0rRigENa9FxQugqypCj2tr D4ylPzY9etZfI8LQjgLDozULOj3hEA7hcCGRuVBd2vlIS/1EcLJTqUySIzsz7NoBLSmr 6ttg== 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; bh=LqVi1TJxUcm9GhB30z4g5FhL0QxA8JdU8a1O2g7JBWw=; fh=5XKO4FJFa744F7hHLL6pG6MPZgtIgKlwP2n1WruVqgQ=; b=E2kopZoiGYD0+ScKcTHwOwG0K0n1sQy/EWsEQ0UvTY3HgAnntAjBaxfgHDrSzbwn0X OpkIjsRcUqmFArXSPoBkeZ4enCbMqHy/aGv8w+loBFw7vbL8efj/QnBjvoqL9vBF9Whr lw8kOpdZEdFA1Ex5aovcoatIfH3eUSGvhJcRAJOh6CafdpcEKyEdRtrxyQDbwXVLbQ2f NNRTGXmeYqHfA4b0ZszsoCu/K1NxFXg9YuzOORrL7rm7h2I5gQGDys23NPbs/wuV4qfj HbcUz0Oh4FCqLo7Q8MEgFHk5AfTA6uOntJ0rKgNztpmTfOPZaoMXg91RH6h9LShkVpiQ Iq/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-127375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q10-20020a170906360a00b00a4a34120ed2si5243121ejb.188.2024.04.01.21.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 21:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-127375-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127375-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 am.mirrors.kernel.org (Postfix) with ESMTPS id E6F8B1F23206 for ; Tue, 2 Apr 2024 04:27:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 103D118E1C; Tue, 2 Apr 2024 04:27:13 +0000 (UTC) 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 89E62182C3 for ; Tue, 2 Apr 2024 04:27:12 +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=1712032032; cv=none; b=VUbBzyv9tSMm8Mw0SVH6CZrT0oydF/lWfO7NNtsKIDnB4WsRx5vQqulG8jdkcnFYJ41v2m/uhRjwv1kbomOH3VVZJV4r46STvaQxJ1hlCVvJVdbqhFKiItrUgrghJAWxOF4x4zTSXAq1HjXe2Gmt8+sFP0su2dQr4gEbK0pgfY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712032032; c=relaxed/simple; bh=tg20vIYtQAbEjR/CpCzmgPfaaRyjY/cpsAH8T7IzX6o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OpACuU0lGYdaMhmt2qvskKPC7Rljl14+GQOx2oryapghRJpPegwAtLPNVzd4KHvZt3/ohcuEtbo6s/6fnut7fuGQvR8pboGBZlXdesawyfxDpQWnoS4N/DqQIE/ZrjL6uoVWweczZXjJT+LUadd5toeJZGGYaListl/TsUry8TQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7F6CC43399; Tue, 2 Apr 2024 04:27:11 +0000 (UTC) From: Al Viro To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, "David S. Miller" , Andreas Larsson , Palmer Dabbelt , Arnd Bergmann , Marco Elver Subject: [PATCH 4/8] sparc32: add __cmpxchg_u{8,16}() and teach __cmpxchg() to handle those sizes Date: Tue, 2 Apr 2024 00:28:31 -0400 Message-Id: <20240402042835.11815-4-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240402042835.11815-1-viro@zeniv.linux.org.uk> References: <20240402041138.GF538574@ZenIV> <20240402042835.11815-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit trivial now Signed-off-by: Al Viro --- arch/sparc/include/asm/cmpxchg_32.h | 7 ++++++- arch/sparc/lib/atomic32.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 86254c366477..1324984de36a 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h @@ -38,7 +38,8 @@ static __always_inline unsigned long __arch_xchg(unsigned long x, __volatile__ v /* bug catcher for when unsupported size is used - won't link */ void __cmpxchg_called_with_bad_pointer(void); -/* we only need to support cmpxchg of a u32 on sparc */ +u8 __cmpxchg_u8(volatile u8 *m, u8 old, u8 new_); +u16 __cmpxchg_u16(volatile u16 *m, u16 old, u16 new_); u32 __cmpxchg_u32(volatile u32 *m, u32 old, u32 new_); /* don't worry...optimizer will get rid of most of this */ @@ -46,6 +47,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) { switch (size) { + case 1: + return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); + case 2: + return __cmpxchg_u16((u16 *)ptr, (u16)old, (u16)new_); case 4: return __cmpxchg_u32((u32 *)ptr, (u32)old, (u32)new_); default: diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index 0d215a772428..8ae880ebf07a 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c @@ -173,8 +173,12 @@ EXPORT_SYMBOL(sp32___change_bit); return prev; \ } +CMPXCHG(u8) +CMPXCHG(u16) CMPXCHG(u32) CMPXCHG(u64) +EXPORT_SYMBOL(__cmpxchg_u8); +EXPORT_SYMBOL(__cmpxchg_u16); EXPORT_SYMBOL(__cmpxchg_u32); EXPORT_SYMBOL(__cmpxchg_u64); -- 2.39.2