From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CCC0F44847 for ; Fri, 10 Apr 2026 12:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=cA5fsHKS5zMwzBxci+DP1Qed/9F1OdcNJnHEKWRTFD0=; b=U+ZEVIdDMEoExC xodMFjP3SMAabgzKZ0vx7hYHX9BfbLv2Mp8KzrdQoD56jVxKegIWQPJWzVOJkDUG9bUdVj7YOQD60 F4wP1vUnEPx1POtx8kOV7HYUGqKA2/weaap5bvhq/RYeym+eSe7Z9fRooeqOqY8epqXspS5BJUyej SzrEXSI0X72ShPS5L4GSxoZGHwPUa4pFYJ8KqvYLiZWnojMDmAomd33d4B15bANs8pfaUJivhtroV mX4kYpqArYPT4nISqlceeSpDiSK6/gFCjlUeVmb+OZ9UvPjJX8wOTrJfNHnI0RK5Qbc9pXF6ILg/3 m65ND2gIvYIkdPDAAh6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wBAr1-0000000CC2v-2XN7; Fri, 10 Apr 2026 12:20:55 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wBAqm-0000000CBfk-28Kz; Fri, 10 Apr 2026 12:20:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 1605941780; Fri, 10 Apr 2026 12:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B1D3C2BC9E; Fri, 10 Apr 2026 12:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775823639; bh=xuHY9CZoFUC3Uh1usl17ZiiMpll/sjP+R8Uwlr/gPtE=; h=Date:From:To:Cc:Subject:References:From; b=q1INVKXpZHtktKQFtR7J0+4UmhxfrqTk44NJDJ9JcHhB06YLNiRtKSdKF4mgJVuJK SbcmSgsMKGBRlcg33rDyUOrFSOUDUDhFVtStbWiiXhg+24Wo0rvXGROWGoPGbTgWpY 1QIfeqOqXuPtKqCTAnTH/4z6y5eKaf0+C4alVsAJYiVtcktTob8TzqOeasZ85w0p7X BtZas6qdu0vK0vHim0/6rol7iQm8En5aXNu+7ovbB+IOTj4HSKX+ow5cG7qCECZo1T 4BmBLkbX+cyQgBzFeuQcBUbwDEtuOB2nQvII7+MypdiMTP4ticoX+aM+zON4QU+Q9r WXrWSNCF41x9w== Date: Fri, 10 Apr 2026 14:20:35 +0200 Message-ID: <20260410120319.330598126@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: Huacai Chen , loongarch@lists.linux.dev, Arnd Bergmann , x86@kernel.org, Lu Baolu , iommu@lists.linux.dev, Michael Grzeschik , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Herbert Xu , linux-crypto@vger.kernel.org, Vlastimil Babka , linux-mm@kvack.org, David Woodhouse , Bernie Thompson , linux-fbdev@vger.kernel.org, "Theodore Tso" , linux-ext4@vger.kernel.org, Andrew Morton , Uladzislau Rezki , Marco Elver , Dmitry Vyukov , kasan-dev@googlegroups.com, Andrey Ryabinin , Thomas Sailer , linux-hams@vger.kernel.org, "Jason A. Donenfeld" , Richard Henderson , linux-alpha@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Dinh Nguyen , Jonas Bonn , linux-openrisc@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , linux-riscv@lists.infradead.org, Heiko Carstens , linux-s390@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org Subject: [patch 26/38] loongarch: Select ARCH_HAS_RANDOM_ENTROPY References: <20260410120044.031381086@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260410_052041_205260_927CFC5D X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The only remaining non-architecture usage of get_cycles() is to provide random_get_entropy(). Switch loongarch over to the new scheme of selecting ARCH_HAS_RANDOM_ENTROPY and providing random_get_entropy() in asm/random.h. Add 'asm/timex.h' includes to the relevant files, so the global include can be removed once all architectures are converted over. Signed-off-by: Thomas Gleixner Cc: Huacai Chen Cc: loongarch@lists.linux.dev --- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/random.h | 15 +++++++++++++++ arch/loongarch/kernel/syscall.c | 1 + arch/loongarch/lib/delay.c | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -26,6 +26,7 @@ config LOONGARCH select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PREEMPT_LAZY select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_RANDOM_ENTROPY select ARCH_HAS_SET_MEMORY select ARCH_HAS_SET_DIRECT_MAP select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST --- /dev/null +++ b/arch/loongarch/include/asm/random.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited + */ +#ifndef _ASM_RANDOM_H +#define _ASM_RANDOM_H + +#include + +static inline unsigned long random_get_entropy(void) +{ + return get_cycles(); +} + +#endif /* _ASM_RANDOM_H */ --- a/arch/loongarch/kernel/syscall.c +++ b/arch/loongarch/kernel/syscall.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #undef __SYSCALL --- a/arch/loongarch/lib/delay.c +++ b/arch/loongarch/lib/delay.c @@ -5,9 +5,9 @@ #include #include #include -#include #include +#include void __delay(unsigned long cycles) {