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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 BC0BBF4484C for ; Fri, 10 Apr 2026 12:21:36 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4fsbVY0nk1z2yrK; Fri, 10 Apr 2026 22:20:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.105.4.254 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775823637; cv=none; b=E779qHQjHQJgJVyEqDfd+trUO2vHjpIHOs+81D/OcbMI2dHqseUHxcxFFu/I9Q7SJLaJ1m3Eax9N+qOPwYrp7BZmt//kSLJ+uiXYRyvtmL8CBTl6nAqq1cKLlEk1uHPU7p1d/ZlNMqOTLOHI72glinaFSD8BcjjUxO6WjShzIdg4cgY6L3iRX/tUkV5hh+wAQNX3r3k5E2yVrVvuCkIVL04Z3AjN5kEGdrBl/bYMWpKJ+lNXBfn5/i6va7GE/ECbzlpyZGwZjZISsMxb5wZ40Y86/AWjX0k79weqAANzewuTQqyOyQIm+yMo9H1xU4dF32+DjOHOh1qe2HNBFXGIJQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775823637; c=relaxed/relaxed; bh=T5BmJ1FF4HBJvfl1JxkNrWx4X3v6jSPy5n7OMhgiRsc=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Jxyu9OMLG4mS0yaBAIcPOuz1W4d98LnoPJx4uZrPoNkSQLYxQ7ah9+7FVIk0c56JU2g9uAUOM1FJGDEImpQcq8smuUC9cMRzBEJh5DszS4pexr9hBkvQ/7qU2bc9CYsMlo6GW8YzxaC3/T1xQZjANzqoGziaVW5JWfTC50nxDdPQ4JbWxU47JwCvPwHJnBc09huv1YkSLfdzx8MRMYwiKVDZishb4qbKOLqpDE53TO4pssJIsl7BWPpXgxrBGu0bH0dm/Ir9+pDrKpUiM2k7aSwJ1Luu38a17QdkW0ZVxH3eV6PeHmfEfNlK08qjuVNHdQPN6yS0NtaNrvxZpdgpDw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=UsSMuuI0; dkim-atps=neutral; spf=pass (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=tglx@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=UsSMuuI0; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=tglx@kernel.org; receiver=lists.ozlabs.org) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4fsbVX1z3tz2yrD for ; Fri, 10 Apr 2026 22:20:36 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 6C7C26024D; Fri, 10 Apr 2026 12:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59123C2BC87; Fri, 10 Apr 2026 12:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775823634; bh=dDZlZkUBE8Yoz+Mf4b2btSZILqeS3wHEYjrON1rjw6U=; h=Date:From:To:Cc:Subject:References:From; b=UsSMuuI0fLabe+4dL8zTL2gq7n1Qam6gWMJ4FfKEoBXmYXreb34mK0jfpqexOCcjk URd+7aIYau5Paex32UCyAHBB1baazBC53HlWWmD8jGnelNjcRxfUYPATekVzRrqJDT SM4YYaTAd2jF6zuzF3s9v75IAyeOupGmOZUxJte/r7FKLtBw0S1j/Gfer+oeitcrs9 GcWasj5F60hnX72mh29rwAv4UlAzszLEnt4a+71ByOcLxgUh/fQSei1PCaUTQnLPFS AyV/TWXRXX6WJrt/PID7Ovi55s49ArxiVCGwFwMjqqfxuev0KPjerElNRcERH69T8a bfdJGP+BHG9rw== Date: Fri, 10 Apr 2026 14:20:31 +0200 Message-ID: <20260410120319.263143276@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, 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 , Huacai Chen , loongarch@lists.linux.dev, 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 25/38] arm64: Select ARCH_HAS_RANDOM_ENTROPY References: <20260410120044.031381086@kernel.org> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 The only remaining usage of get_cycles() is to provide random_get_entropy(). Switch arm64 over to the new scheme of selecting ARCH_HAS_RANDOM_ENTROPY and providing random_get_entropy() in asm/random.h. As a consequence this unearthed a nasty include dependecy hell where random code including rqspinlock.h relies on a magic include of asm/arch_timer.h. Including the headers in asm/random.h turned out to be impossible as well. The only solution for now is to uninline random_get_entropy(). Fix up all other dependencies on the content of asm/timex.h in those files which really depend on it. Remove asm/timex.h as it has no functionality anymore. Signed-off-by: Thomas Gleixner Cc: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/io.h | 5 +++-- arch/arm64/include/asm/random.h | 11 +++++++++++ arch/arm64/include/asm/rqspinlock.h | 1 + arch/arm64/include/asm/timex.h | 18 ------------------ arch/arm64/kernel/time.c | 6 ++++++ arch/arm64/kernel/topology.c | 1 + arch/arm64/kernel/traps.c | 1 + arch/arm64/kvm/emulate-nested.c | 1 + arch/arm64/kvm/hyp/include/hyp/switch.h | 1 + arch/arm64/lib/delay.c | 1 + drivers/irqchip/irq-apple-aic.c | 1 + 12 files changed, 28 insertions(+), 20 deletions(-) --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -45,6 +45,7 @@ config ARM64 select ARCH_HAS_PREEMPT_LAZY select ARCH_HAS_PTDUMP select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_RANDOM_ENTROPY select ARCH_HAS_HW_PTE_YOUNG select ARCH_HAS_SETUP_DMA_OPS select ARCH_HAS_SET_DIRECT_MAP --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -100,12 +100,13 @@ static __always_inline u64 __raw_readq(c ({ \ unsigned long tmp; \ \ - dma_rmb(); \ + dma_rmb(); \ \ /* \ * Create a dummy control dependency from the IO read to any \ * later instructions. This ensures that a subsequent call to \ - * udelay() will be ordered due to the ISB in get_cycles(). \ + * udelay() will be ordered due to the ISB in \ + * arm_timer_read_counter(). \ */ \ asm volatile("eor %0, %1, %1\n" \ "cbnz %0, ." \ --- /dev/null +++ b/arch/arm64/include/asm/random.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2012 ARM Ltd. + */ +#ifndef __ASM_RANDOM_H +#define __ASM_RANDOM_H + +/* Out of line to avoid recursive include hell */ +unsigned long random_get_entropy(void); + +#endif --- a/arch/arm64/include/asm/rqspinlock.h +++ b/arch/arm64/include/asm/rqspinlock.h @@ -2,6 +2,7 @@ #ifndef _ASM_RQSPINLOCK_H #define _ASM_RQSPINLOCK_H +#include #include /* --- a/arch/arm64/include/asm/timex.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2012 ARM Ltd. - */ -#ifndef __ASM_TIMEX_H -#define __ASM_TIMEX_H - -#include - -/* - * Use the current timer as a cycle counter since this is what we use for - * the delay loop. - */ -#define get_cycles() arch_timer_read_counter() - -#include - -#endif --- a/arch/arm64/kernel/time.c +++ b/arch/arm64/kernel/time.c @@ -29,6 +29,7 @@ #include +#include #include #include @@ -52,6 +53,11 @@ unsigned long profile_pc(struct pt_regs } EXPORT_SYMBOL(profile_pc); +static unsigned long random_get_entropy(void) +{ + return arch_timer_read_counter(); +} + void __init time_init(void) { u32 arch_timer_rate; --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include --- a/arch/arm64/kvm/emulate-nested.c +++ b/arch/arm64/kvm/emulate-nested.c @@ -7,6 +7,7 @@ #include #include +#include #include #include --- a/arch/arm64/kvm/hyp/include/hyp/switch.h +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -18,6 +18,7 @@ #include +#include #include #include #include --- a/arch/arm64/lib/delay.c +++ b/arch/arm64/lib/delay.c @@ -14,6 +14,7 @@ #include #include +#include #define USECS_TO_CYCLES(time_usecs) \ xloops_to_cycles((time_usecs) * 0x10C7UL) --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include