Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2221845/?format=api
{ "id": 2221845, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2221845/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260410120317.978403520@kernel.org/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/1.2/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260410120317.978403520@kernel.org>", "list_archive_url": null, "date": "2026-04-10T12:18:57", "name": "[06/38] calibrate: Rework delay timer calibration", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e82103b5e223e8c14597caa1b1920e7694e3c617", "submitter": { "id": 92397, "url": "http://patchwork.ozlabs.org/api/1.2/people/92397/?format=api", "name": "Thomas Gleixner", "email": "tglx@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/20260410120317.978403520@kernel.org/mbox/", "series": [ { "id": 499451, "url": "http://patchwork.ozlabs.org/api/1.2/series/499451/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=499451", "date": "2026-04-10T12:18:27", "name": "treewide: Cleanup LATCH, CLOCK_TICK_RATE and get_cycles() [ab]use", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499451/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2221845/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2221845/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=hlZe=CJ=vger.kernel.org=linux-ext4+bounces-15741-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-ext4@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=QXjWZmAy;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=hlze=cj=vger.kernel.org=linux-ext4+bounces-15741-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.105.105.114 arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=QXjWZmAy;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15741-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"QXjWZmAy\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsbbD4ZvLz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 22:24:40 +1000 (AEST)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fsbbD469Dz4wK5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 22:24:40 +1000 (AEST)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fsbbD3vVPz4wJS; Fri, 10 Apr 2026 22:24:40 +1000 (AEST)", "from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fsbb741Tfz4wLx\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Apr 2026 22:24:35 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 661B43080C99\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 10 Apr 2026 12:19:55 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D45E53C9EDE;\n\tFri, 10 Apr 2026 12:19:01 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 86AC33BD64E;\n\tFri, 10 Apr 2026 12:19:01 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 90115C19425;\n\tFri, 10 Apr 2026 12:19:00 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775823880; cv=pass;\n\tb=Pn8DWjxkLBkTfRmwgGmklq8DGZ4ksbAEntMbe7TtfNsnYXoz9qWqPIXMlQg19FXxmQaf+2FxhfYFt5cLDuszgmy8H3E+yUiOrYoFttEMJ6CH1X4k3ADoo1tr42RqPMl8zUozlVEXf0DZAAKsO3YcXCVNBCESs9+oHyatB52OODJAuUybRSB8KxDCfcWilu+cedpcVPR0pvrasmz+XTzH2NOYyEcD5KabmcKFSbc5KdvfUU1SmIrp0ISv0mTZg6GMsRdJXCoAc2TxEEGms1zLXLa2J2ajKCXz2lp4yH1d45kVx9ycScMU24nHGnpPrS4Mr7g9hJl4XXiiaxZ8fBTC6g==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775823541; cv=none;\n b=Px7ny0ZNfiwxgo5HylHhqUqUuKw83r7is4ajUBW88OefDmadycMe1lMwz5t83SLtP78ThyF58bPPDiTOejddXP/WqIyrHMMCZfVp44/vB+IlrjgXzZ0czeuWfU9E+VxfQA1uhQxR2+uw/PcpUZ5lxByyTIr4gsyZ2Hh9Jbp7F6A=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775823880; c=relaxed/relaxed;\n\tbh=/R+R4d5SDQH9jdK/3klo3EYhhkQvOOYSCHJi47wUl54=;\n\th=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version:\n\t Content-Type;\n b=jQ/ZWeyYgNWrh7f9A4YOZvxVe9Yy1m/EZAyKz2Msx3HhtCsycw8Tg9x3NsiWstch0v0ZOuRCKXi4Q3iaqTIR9FvTm2yTrf+vl8C/tgocHcNhRQBfQXj0lws6Fo9MyJ48P9cb4HpaKGSWv3/8LbyESjAcbRP/nqMkS92vYUMvmj2ufRikARMNIJR/wjwgaVWI5sfUDwWdZqRpO2kxnAZdsx9C67PMMibquXpqGEF/pN0sskytYplZxUnBxrIvJ3Hlh42K497w/qitBAEgblKNhJpVVgGfckdmA/qeLhrrme/aJcnkQlLGmNh8iKXMWdJT5S0CpfmbIbH+UJLiPie9bA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775823541; c=relaxed/simple;\n\tbh=tQOpQ/MIydS0DCislclXfYYGX/MLE87s4jSCgeL+WRY=;\n\th=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version:\n\t Content-Type;\n b=pDOilWArj3eB0SkYqjcthTQDUOBVBAXinuRPbsCLaqu0pNIYtd1vQDlERI6iqYlAWSLO02AWwo0qJAo+XcA6ZSezmKAUScm0HJCV8UFQd26RAhHU6z9wwO4n7EvS/gJZgOSYXMwx2PwQRY71LrXXq3f2huIgdg9OJ6O6cH0qA90=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=QXjWZmAy; dkim-atps=neutral;\n spf=pass (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15741-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=QXjWZmAy; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775823541;\n\tbh=tQOpQ/MIydS0DCislclXfYYGX/MLE87s4jSCgeL+WRY=;\n\th=Date:From:To:Cc:Subject:References:From;\n\tb=QXjWZmAyCTkHp5kfenmZQLgv/6aaV3rIg6DEVvlyBDoQvhTKTRyPfm45H+KsvdAYy\n\t VHZ0mkxMvX7NrAkZvm3k49raaKd2C+9wSQwjJDY1g6mCI0csX9QiI7H4JXm3HNueX3\n\t EOv1ltqGraI125ajQJZTWidJZvX+BaYkMhFhYKyP7KvvAlz25RxVHq+2fEWi/RQGR8\n\t Hcehq8u7DgPSnaFiQzuBhfPrBLqOhc8OPmg3byOKx6qYpgk7RPMNSknmgg5KdEM/9q\n\t gq5iGE6+JxvJ8JrvjFxV3K0ttPe/RN2jOy+C/nJannjRPpT1rSSYryTOpfiapdmnXH\n\t zppEqqCxX8IxA==", "Date": "Fri, 10 Apr 2026 14:18:57 +0200", "Message-ID": "<20260410120317.978403520@kernel.org>", "User-Agent": "quilt/0.68", "From": "Thomas Gleixner <tglx@kernel.org>", "To": "LKML <linux-kernel@vger.kernel.org>", "Cc": "Arnd Bergmann <arnd@arndb.de>,\n x86@kernel.org,\n Lu Baolu <baolu.lu@linux.intel.com>,\n iommu@lists.linux.dev,\n Michael Grzeschik <m.grzeschik@pengutronix.de>,\n netdev@vger.kernel.org,\n linux-wireless@vger.kernel.org,\n Herbert Xu <herbert@gondor.apana.org.au>,\n linux-crypto@vger.kernel.org,\n Vlastimil Babka <vbabka@kernel.org>,\n linux-mm@kvack.org,\n David Woodhouse <dwmw2@infradead.org>,\n Bernie Thompson <bernie@plugable.com>,\n linux-fbdev@vger.kernel.org,\n \"Theodore Tso\" <tytso@mit.edu>,\n linux-ext4@vger.kernel.org,\n Andrew Morton <akpm@linux-foundation.org>,\n Uladzislau Rezki <urezki@gmail.com>,\n Marco Elver <elver@google.com>,\n Dmitry Vyukov <dvyukov@google.com>,\n kasan-dev@googlegroups.com,\n Andrey Ryabinin <ryabinin.a.a@gmail.com>,\n Thomas Sailer <t.sailer@alumni.ethz.ch>,\n linux-hams@vger.kernel.org,\n \"Jason A. Donenfeld\" <Jason@zx2c4.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n linux-alpha@vger.kernel.org,\n Russell King <linux@armlinux.org.uk>,\n linux-arm-kernel@lists.infradead.org,\n Catalin Marinas <catalin.marinas@arm.com>,\n Huacai Chen <chenhuacai@kernel.org>,\n loongarch@lists.linux.dev,\n Geert Uytterhoeven <geert@linux-m68k.org>,\n linux-m68k@lists.linux-m68k.org,\n Dinh Nguyen <dinguyen@kernel.org>,\n Jonas Bonn <jonas@southpole.se>,\n linux-openrisc@vger.kernel.org,\n Helge Deller <deller@gmx.de>,\n linux-parisc@vger.kernel.org,\n Michael Ellerman <mpe@ellerman.id.au>,\n linuxppc-dev@lists.ozlabs.org,\n Paul Walmsley <pjw@kernel.org>,\n linux-riscv@lists.infradead.org,\n Heiko Carstens <hca@linux.ibm.com>,\n linux-s390@vger.kernel.org,\n \"David S. Miller\" <davem@davemloft.net>,\n sparclinux@vger.kernel.org", "Subject": "[patch 06/38] calibrate: Rework delay timer calibration", "References": "<20260410120044.031381086@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "linux-ext4@vger.kernel.org", "List-Id": "<linux-ext4.vger.kernel.org>", "List-Subscribe": "<mailto:linux-ext4+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-ext4+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "The header define in asm/timex,h and the naming of the function to read the\ndelay timer are confusing at best.\n\nConvert it to a config switch selected by the archictures, which provide\nthe functionality, and rename the function to delay_read_timer(), which\nmakes the purpose clear. Move the declaration to linux/delay.h where it\nbelongs.\n\nRemove the resulting empty asm/timex.h files as well.\n\nNo functional change.\n\nSigned-off-by: Thomas Gleixner <tglx@kernel.org>\nCc: Arnd Bergmann <arnd@arndb.de>\n---\n arch/Kconfig | 3 +++\n arch/arm/Kconfig | 1 +\n arch/arm/include/asm/delay.h | 1 -\n arch/arm/include/asm/timex.h | 5 ++++-\n arch/arm/lib/delay.c | 10 ++++------\n arch/hexagon/Kconfig | 1 +\n arch/hexagon/include/asm/timex.h | 20 --------------------\n arch/hexagon/kernel/time.c | 8 +++++++-\n arch/openrisc/Kconfig | 1 +\n arch/openrisc/include/asm/timex.h | 2 --\n arch/openrisc/lib/delay.c | 9 ++++-----\n arch/riscv/Kconfig | 1 +\n arch/riscv/include/asm/timex.h | 8 --------\n arch/riscv/lib/delay.c | 7 ++++++-\n arch/sparc/Kconfig | 1 +\n arch/sparc/include/asm/timex_64.h | 2 --\n arch/sparc/kernel/time_64.c | 4 ++--\n arch/x86/Kconfig | 1 +\n arch/x86/include/asm/timex.h | 2 --\n arch/x86/lib/delay.c | 8 +++-----\n include/asm-generic/timex.h | 7 -------\n include/linux/delay.h | 2 ++\n include/linux/timex.h | 2 --\n init/calibrate.c | 19 +++++++++----------\n 24 files changed, 50 insertions(+), 75 deletions(-)", "diff": "--- a/arch/Kconfig\n+++ b/arch/Kconfig\n@@ -363,6 +363,9 @@ config ARCH_HAS_DMA_CLEAR_UNCACHED\n config ARCH_HAS_CPU_FINALIZE_INIT\n \tbool\n \n+config ARCH_HAS_DELAY_TIMER\n+\tbool\n+\n # The architecture has a per-task state that includes the mm's PASID\n config ARCH_HAS_CPU_PASID\n \tbool\n--- a/arch/arm/Kconfig\n+++ b/arch/arm/Kconfig\n@@ -11,6 +11,7 @@ config ARM\n \tselect ARCH_HAS_CPU_FINALIZE_INIT if MMU\n \tselect ARCH_HAS_CURRENT_STACK_POINTER\n \tselect ARCH_HAS_DEBUG_VIRTUAL if MMU\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect ARCH_HAS_DMA_ALLOC if MMU\n \tselect ARCH_HAS_DMA_OPS\n \tselect ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE\n--- a/arch/arm/include/asm/delay.h\n+++ b/arch/arm/include/asm/delay.h\n@@ -91,7 +91,6 @@ extern void __loop_udelay(unsigned long\n extern void __loop_const_udelay(unsigned long);\n \n /* Delay-loop timer registration. */\n-#define ARCH_HAS_READ_CURRENT_TIMER\n extern void register_current_timer_delay(const struct delay_timer *timer);\n \n #endif /* __ASSEMBLY__ */\n--- a/arch/arm/include/asm/timex.h\n+++ b/arch/arm/include/asm/timex.h\n@@ -10,7 +10,10 @@\n #define _ASMARM_TIMEX_H\n \n typedef unsigned long cycles_t;\n-#define get_cycles()\t({ cycles_t c; read_current_timer(&c) ? 0 : c; })\n+// Temporary workaround\n+bool delay_read_timer(unsigned long *t);\n+\n+#define get_cycles()\t({ cycles_t c; delay_read_timer(&c) ? 0 : c; })\n #define random_get_entropy() (((unsigned long)get_cycles()) ?: random_get_entropy_fallback())\n \n #endif\n--- a/arch/arm/lib/delay.c\n+++ b/arch/arm/lib/delay.c\n@@ -12,7 +12,6 @@\n #include <linux/init.h>\n #include <linux/kernel.h>\n #include <linux/module.h>\n-#include <linux/timex.h>\n \n /*\n * Default to the loop-based delay implementation.\n@@ -27,15 +26,14 @@ static const struct delay_timer *delay_t\n static bool delay_calibrated;\n static u64 delay_res;\n \n-int read_current_timer(unsigned long *timer_val)\n+bool delay_read_timer(unsigned long *timer_val)\n {\n \tif (!delay_timer)\n-\t\treturn -ENXIO;\n-\n+\t\treturn false;\n \t*timer_val = delay_timer->read_current_timer();\n-\treturn 0;\n+\treturn true;\n }\n-EXPORT_SYMBOL_GPL(read_current_timer);\n+EXPORT_SYMBOL_GPL(delay_read_timer);\n \n static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift)\n {\n--- a/arch/hexagon/Kconfig\n+++ b/arch/hexagon/Kconfig\n@@ -5,6 +5,7 @@ comment \"Linux Kernel Configuration for\n config HEXAGON\n \tdef_bool y\n \tselect ARCH_32BIT_OFF_T\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect ARCH_HAS_SYNC_DMA_FOR_DEVICE\n \tselect ARCH_NO_PREEMPT\n \tselect ARCH_WANT_FRAME_POINTERS\n--- a/arch/hexagon/include/asm/timex.h\n+++ /dev/null\n@@ -1,20 +0,0 @@\n-/* SPDX-License-Identifier: GPL-2.0-only */\n-/*\n- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.\n- */\n-\n-#ifndef _ASM_TIMEX_H\n-#define _ASM_TIMEX_H\n-\n-#include <asm-generic/timex.h>\n-#include <asm/hexagon_vm.h>\n-\n-#define ARCH_HAS_READ_CURRENT_TIMER\n-\n-static inline int read_current_timer(unsigned long *timer_val)\n-{\n-\t*timer_val = __vmgettime();\n-\treturn 0;\n-}\n-\n-#endif\n--- a/arch/hexagon/kernel/time.c\n+++ b/arch/hexagon/kernel/time.c\n@@ -6,6 +6,7 @@\n */\n \n #include <linux/init.h>\n+#include <linux/delay.h>\n #include <linux/clockchips.h>\n #include <linux/clocksource.h>\n #include <linux/interrupt.h>\n@@ -17,7 +18,6 @@\n #include <linux/of_irq.h>\n #include <linux/module.h>\n \n-#include <asm/delay.h>\n #include <asm/hexagon_vm.h>\n #include <asm/time.h>\n \n@@ -231,3 +231,9 @@ void __udelay(unsigned long usecs)\n \t\tcpu_relax(); /* not sure how this improves readability */\n }\n EXPORT_SYMBOL(__udelay);\n+\n+bool delay_read_timer(unsigned long *timer_val)\n+{\n+\t*timer_val = __vmgettime();\n+\treturn true;\n+}\n--- a/arch/openrisc/Kconfig\n+++ b/arch/openrisc/Kconfig\n@@ -7,6 +7,7 @@\n config OPENRISC\n \tdef_bool y\n \tselect ARCH_32BIT_OFF_T\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect ARCH_HAS_DMA_SET_UNCACHED\n \tselect ARCH_HAS_DMA_CLEAR_UNCACHED\n \tselect ARCH_HAS_SYNC_DMA_FOR_DEVICE\n--- a/arch/openrisc/include/asm/timex.h\n+++ b/arch/openrisc/include/asm/timex.h\n@@ -25,6 +25,4 @@ static inline cycles_t get_cycles(void)\n }\n #define get_cycles get_cycles\n \n-#define ARCH_HAS_READ_CURRENT_TIMER\n-\n #endif\n--- a/arch/openrisc/lib/delay.c\n+++ b/arch/openrisc/lib/delay.c\n@@ -13,18 +13,17 @@\n */\n \n #include <linux/kernel.h>\n+#include <linux/delay.h>\n #include <linux/export.h>\n #include <linux/init.h>\n-#include <linux/timex.h>\n+\n #include <asm/param.h>\n-#include <asm/delay.h>\n-#include <asm/timex.h>\n #include <asm/processor.h>\n \n-int read_current_timer(unsigned long *timer_value)\n+bool delay_read_timer(unsigned long *timer_value)\n {\n \t*timer_value = get_cycles();\n-\treturn 0;\n+\treturn true;\n }\n \n void __delay(unsigned long cycles)\n--- a/arch/riscv/Kconfig\n+++ b/arch/riscv/Kconfig\n@@ -29,6 +29,7 @@ config RISCV\n \tselect ARCH_HAS_DEBUG_VIRTUAL if MMU\n \tselect ARCH_HAS_DEBUG_VM_PGTABLE\n \tselect ARCH_HAS_DEBUG_WX\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect ARCH_HAS_ELF_CORE_EFLAGS if BINFMT_ELF && ELF_CORE\n \tselect ARCH_HAS_FAST_MULTIPLIER\n \tselect ARCH_HAS_FORTIFY_SOURCE\n--- a/arch/riscv/include/asm/timex.h\n+++ b/arch/riscv/include/asm/timex.h\n@@ -80,12 +80,4 @@ static inline u64 get_cycles64(void)\n \treturn ((u64)hi << 32) | lo;\n }\n #endif /* CONFIG_64BIT */\n-\n-#define ARCH_HAS_READ_CURRENT_TIMER\n-static inline int read_current_timer(unsigned long *timer_val)\n-{\n-\t*timer_val = get_cycles();\n-\treturn 0;\n-}\n-\n #endif /* _ASM_RISCV_TIMEX_H */\n--- a/arch/riscv/lib/delay.c\n+++ b/arch/riscv/lib/delay.c\n@@ -6,7 +6,6 @@\n #include <linux/delay.h>\n #include <linux/math.h>\n #include <linux/param.h>\n-#include <linux/timex.h>\n #include <linux/types.h>\n #include <linux/export.h>\n \n@@ -109,3 +108,9 @@ void ndelay(unsigned long nsecs)\n \t__delay(ncycles >> NDELAY_SHIFT);\n }\n EXPORT_SYMBOL(ndelay);\n+\n+bool delay_read_timer(unsigned long *timer_val)\n+{\n+\t*timer_val = get_cycles();\n+\treturn true;\n+}\n--- a/arch/sparc/Kconfig\n+++ b/arch/sparc/Kconfig\n@@ -70,6 +70,7 @@ config SPARC32\n config SPARC64\n \tdef_bool 64BIT\n \tselect ALTERNATE_USER_ADDRESS_SPACE\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect HAVE_FUNCTION_TRACER\n \tselect HAVE_FUNCTION_GRAPH_TRACER\n \tselect HAVE_KRETPROBES\n--- a/arch/sparc/include/asm/timex_64.h\n+++ b/arch/sparc/include/asm/timex_64.h\n@@ -13,6 +13,4 @@\n typedef unsigned long cycles_t;\n #define get_cycles()\ttick_ops->get_tick()\n \n-#define ARCH_HAS_READ_CURRENT_TIMER\n-\n #endif\n--- a/arch/sparc/kernel/time_64.c\n+++ b/arch/sparc/kernel/time_64.c\n@@ -894,8 +894,8 @@ unsigned long long sched_clock(void)\n \treturn ((get_tick() * quotient) >> SPARC64_NSEC_PER_CYC_SHIFT) - offset;\n }\n \n-int read_current_timer(unsigned long *timer_val)\n+bool delay_read_timer(unsigned long *timer_val)\n {\n \t*timer_val = get_tick();\n-\treturn 0;\n+\treturn true;\n }\n--- a/arch/x86/Kconfig\n+++ b/arch/x86/Kconfig\n@@ -81,6 +81,7 @@ config X86\n \tselect ARCH_HAS_CURRENT_STACK_POINTER\n \tselect ARCH_HAS_DEBUG_VIRTUAL\n \tselect ARCH_HAS_DEBUG_VM_PGTABLE\tif !X86_PAE\n+\tselect ARCH_HAS_DELAY_TIMER\n \tselect ARCH_HAS_DEVMEM_IS_ALLOWED\n \tselect ARCH_HAS_DMA_OPS\t\t\tif GART_IOMMU || XEN\n \tselect ARCH_HAS_EARLY_DEBUG\t\tif KGDB\n--- a/arch/x86/include/asm/timex.h\n+++ b/arch/x86/include/asm/timex.h\n@@ -14,6 +14,4 @@ static inline unsigned long random_get_e\n }\n #define random_get_entropy random_get_entropy\n \n-#define ARCH_HAS_READ_CURRENT_TIMER\n-\n #endif /* _ASM_X86_TIMEX_H */\n--- a/arch/x86/lib/delay.c\n+++ b/arch/x86/lib/delay.c\n@@ -14,12 +14,10 @@\n \n #include <linux/export.h>\n #include <linux/sched.h>\n-#include <linux/timex.h>\n #include <linux/preempt.h>\n #include <linux/delay.h>\n \n #include <asm/processor.h>\n-#include <asm/delay.h>\n #include <asm/timer.h>\n #include <asm/mwait.h>\n \n@@ -189,13 +187,13 @@ void use_mwaitx_delay(void)\n \tdelay_fn = delay_halt;\n }\n \n-int read_current_timer(unsigned long *timer_val)\n+bool delay_read_timer(unsigned long *timer_val)\n {\n \tif (delay_fn == delay_tsc) {\n \t\t*timer_val = rdtsc();\n-\t\treturn 0;\n+\t\treturn true;\n \t}\n-\treturn -1;\n+\treturn false;\n }\n \n void __delay(unsigned long loops)\n--- a/include/asm-generic/timex.h\n+++ b/include/asm-generic/timex.h\n@@ -13,11 +13,4 @@ static inline cycles_t get_cycles(void)\n }\n #endif\n \n-/*\n- * Architectures are encouraged to implement read_current_timer\n- * and define this in order to avoid the expensive delay loop\n- * calibration during boot.\n- */\n-#undef ARCH_HAS_READ_CURRENT_TIMER\n-\n #endif /* __ASM_GENERIC_TIMEX_H */\n--- a/include/linux/delay.h\n+++ b/include/linux/delay.h\n@@ -17,6 +17,8 @@ extern unsigned long loops_per_jiffy;\n \n #include <asm/delay.h>\n \n+bool delay_read_timer(unsigned long *t);\n+\n /*\n * Using udelay() for intervals greater than a few milliseconds can\n * risk overflow for high loops_per_jiffy (high bogomips) machines. The\n--- a/include/linux/timex.h\n+++ b/include/linux/timex.h\n@@ -156,8 +156,6 @@ extern int do_clock_adjtime(const clocki\n \n extern void hardpps(const struct timespec64 *, const struct timespec64 *);\n \n-int read_current_timer(unsigned long *timer_val);\n-\n /* The clock frequency of the i8253/i8254 PIT */\n #define PIT_TICK_RATE 1193182ul\n \n--- a/init/calibrate.c\n+++ b/init/calibrate.c\n@@ -13,7 +13,6 @@\n #include <linux/printk.h>\n #include <linux/smp.h>\n #include <linux/stddef.h>\n-#include <linux/timex.h>\n \n unsigned long lpj_fine;\n unsigned long preset_lpj;\n@@ -25,9 +24,9 @@ static int __init lpj_setup(char *str)\n \n __setup(\"lpj=\", lpj_setup);\n \n-#ifdef ARCH_HAS_READ_CURRENT_TIMER\n+#ifdef CONFIG_ARCH_HAS_DELAY_TIMER\n \n-/* This routine uses the read_current_timer() routine and gets the\n+/* This routine uses the delay_read_timer() routine and gets the\n * loops per jiffy directly, instead of guessing it using delay().\n * Also, this code tries to handle non-maskable asynchronous events\n * (like SMIs)\n@@ -48,13 +47,13 @@ static unsigned long calibrate_delay_dir\n \tint min = -1;\n \tint i;\n \n-\tif (read_current_timer(&pre_start) < 0 )\n+\tif (!delay_read_timer(&pre_start))\n \t\treturn 0;\n \n \t/*\n \t * A simple loop like\n \t *\twhile ( jiffies < start_jiffies+1)\n-\t *\t\tstart = read_current_timer();\n+\t *\t\tstart = delay_read_timer();\n \t * will not do. As we don't really know whether jiffy switch\n \t * happened first or timer_value was read first. And some asynchronous\n \t * event can happen between these two events introducing errors in lpj.\n@@ -72,22 +71,22 @@ static unsigned long calibrate_delay_dir\n \n \tfor (i = 0; i < MAX_DIRECT_CALIBRATION_RETRIES; i++) {\n \t\tpre_start = 0;\n-\t\tread_current_timer(&start);\n+\t\tdelay_read_timer(&start);\n \t\tstart_jiffies = jiffies;\n \t\twhile (time_before_eq(jiffies, start_jiffies + 1)) {\n \t\t\tpre_start = start;\n-\t\t\tread_current_timer(&start);\n+\t\t\tdelay_read_timer(&start);\n \t\t}\n-\t\tread_current_timer(&post_start);\n+\t\tdelay_read_timer(&post_start);\n \n \t\tpre_end = 0;\n \t\tend = post_start;\n \t\twhile (time_before_eq(jiffies, start_jiffies + 1 +\n \t\t\t\t\t DELAY_CALIBRATION_TICKS)) {\n \t\t\tpre_end = end;\n-\t\t\tread_current_timer(&end);\n+\t\t\tdelay_read_timer(&end);\n \t\t}\n-\t\tread_current_timer(&post_end);\n+\t\tdelay_read_timer(&post_end);\n \n \t\ttimer_rate_max = (post_end - pre_start) /\n \t\t\t\t\tDELAY_CALIBRATION_TICKS;\n", "prefixes": [ "06/38" ] }