Message ID | 20231112061514.2306187-24-guoren@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp562094vqg; Sat, 11 Nov 2023 22:19:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVXRwMMJlYc6Rw5vWsNOQG6jTUnDtvlwhvP7DVfybppVRnS6DL5K3QKy0SZlNGHvLeeu7d X-Received: by 2002:a05:6830:1bfb:b0:6d6:4f73:dbf4 with SMTP id k27-20020a0568301bfb00b006d64f73dbf4mr4317741otb.24.1699769941944; Sat, 11 Nov 2023 22:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699769941; cv=none; d=google.com; s=arc-20160816; b=ZIu4pIaZCvltVD8hoGAQnwWbICwIgxqyE1AOcYlzuO0tHiWQ79wwVAap6zTA1qMbyh FSgYOa5h4iNQ2M6RUWkSi1I7Lv40M2vQMOyqhtBIk3cOP8ymfDiH4175nP39XicBMtnn bmdQGWViWT+/d6q4mKTNIgkOdfYkGYVx0j62Qtcsd2l36ypVU09N1h9WND1BkG7X7xmX ZX5Abw7Mraxom6sPTdeAGhZviOxOPORWTr6Ee6CpsUTM0xnZdUaeuzadG6zHK9Z7KwQU 1WNjxvRlNt4gp2WvAIj2oxr+hI84l+Zxpqhv4pxOryybJlS2g9123yV6agj7zL75tpLi Y5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tU/8eQFgLBGh1wp3u+eugkEkML+bEpBRSzdJS1QZvB8=; fh=ZE/z2dNArDjRCaYXLY1qiMuWjPgjymC0plQjRd9hozE=; b=XAappmnqiIZhcqcqoT6UbjjGXjNmfd/Y41DwsDVwtDZCxUYjDFXNy+pPRYppr9qd8k B/FygN+bYZsRpQ8jz55EvCYGZsahf7tNM0KpRqgUkgB/JMnRbHGGg/0+3ug4SMStKtpM gHRIxDdPPlUhNrBqUPjzmdIggrgj6eiLyivqpTvDO1+P94+t7QAAplg7uAfKY4jcOR1b N+IiDFBTpvSCJIPeJ5q5dKeAHjzTb3Wp1OETNcPcWmn4S443m9xo4F+U0pXYMb2J05Px /LdGvYJmijRsx8ui+RFSEf9wujrf3ujo4oZZfuwZUH4Tk0RngEy0fP3xtn+lEPJgfLx8 Lc3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3mYKvvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id iw21-20020a170903045500b001cc58f174fasi2970154plb.364.2023.11.11.22.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Nov 2023 22:19:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u3mYKvvV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9EE48804AF7B; Sat, 11 Nov 2023 22:18:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbjKLGSt (ORCPT <rfc822;heyuhang3455@gmail.com> + 29 others); Sun, 12 Nov 2023 01:18:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231371AbjKLGSY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 12 Nov 2023 01:18:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D2349E8 for <linux-kernel@vger.kernel.org>; Sat, 11 Nov 2023 22:17:48 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5A01C433D9; Sun, 12 Nov 2023 06:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699769867; bh=DJd0JPnD4tdXPL2F5/pVMn7+3pGHc/BdFV5e1StNJ0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3mYKvvVcCXgok8Svx8v4kF7mGHdEIkfptFpvN3AkwLdtO3ntnvI1tFetv8IzkGud QsqcEzsuLOpPvYOMq//OcMmUt1bX8nDoBgAPmTAQ3RWqjuHAZ6Dde0eSs6C2/y+VxI PDCLedfjiu12dGTFD/L2dYd544DJHkuziYtfgdvNe+TXgj8RPvV5f8jK6eJT4fAhxf aqzzh/LVK8k8ktL94w2cpBMh0gvgCZ0CJTHTeQQHWNyUaWzvHLESSAINDdDCvDxL1V uaLDgFyGRBaolDP18QX6VtyYB/IDSyturZGmHAbMRjanSPG5ujOcv/4DT0ZxwCN0zU kKb1zgIB6qstA== From: guoren@kernel.org To: arnd@arndb.de, guoren@kernel.org, palmer@rivosinc.com, tglx@linutronix.de, conor.dooley@microchip.com, heiko@sntech.de, apatel@ventanamicro.com, atishp@atishpatra.org, bjorn@kernel.org, paul.walmsley@sifive.com, anup@brainfault.org, jiawei@iscas.ac.cn, liweiwei@iscas.ac.cn, wefu@redhat.com, U2FsdGVkX1@gmail.com, wangjunqiang@iscas.ac.cn, kito.cheng@sifive.com, andy.chiu@sifive.com, vincent.chen@sifive.com, greentime.hu@sifive.com, wuwei2016@iscas.ac.cn, jrtc27@jrtc27.com, luto@kernel.org, fweimer@redhat.com, catalin.marinas@arm.com, hjl.tools@gmail.com Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren <guoren@linux.alibaba.com> Subject: [RFC PATCH V2 23/38] riscv: s64ilp32: Enable native atomic64 Date: Sun, 12 Nov 2023 01:14:59 -0500 Message-Id: <20231112061514.2306187-24-guoren@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20231112061514.2306187-1-guoren@kernel.org> References: <20231112061514.2306187-1-guoren@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 11 Nov 2023 22:18:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782337966574281985 X-GMAIL-MSGID: 1782337966574281985 |
Series |
rv64ilp32: Running ILP32 on RV64 ISA
|
|
Commit Message
Guo Ren
Nov. 12, 2023, 6:14 a.m. UTC
From: Guo Ren <guoren@linux.alibaba.com> The traditional rv32 Linux (s32ilp32) uses a generic version of the lib/atomic64.c, which are inaccurate atomic64 primitives and couldn't co-work with READ_ONCE/WRITE_ONCE, atomic_8/16/32. The s64ilp32 could use native AMO instructions to implement accurate atomic64 primitives. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> --- arch/riscv/Kconfig | 2 +- arch/riscv/include/asm/atomic.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index f364d2436b1d..0fc03aa076e6 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -65,7 +65,7 @@ config RISCV select CPU_PM if CPU_IDLE || HIBERNATION select EDAC_SUPPORT select GENERIC_ARCH_TOPOLOGY - select GENERIC_ATOMIC64 if !64BIT + select GENERIC_ATOMIC64 if ARCH_RV32I select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_EARLY_IOREMAP select GENERIC_ENTRY diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h index f5dfef6c2153..8f6579b33ecc 100644 --- a/arch/riscv/include/asm/atomic.h +++ b/arch/riscv/include/asm/atomic.h @@ -16,6 +16,12 @@ # endif #endif +#ifdef CONFIG_ARCH_RV64ILP32 +typedef struct { + s64 counter; +} atomic64_t; +#endif + #include <asm/cmpxchg.h> #include <asm/barrier.h>