mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/hpet: Mark boot-time variables as __ro_after_init
@ 2026-11-17 12:29 Habil Eren Türker
  2026-11-19 19:40 ` Dave Hansen
  0 siblings, 1 reply; 5+ messages in thread
From: Habil Eren Türker @ 2026-11-17 12:29 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Habil Eren Türker, Daniel J Blueman,
	Jiri Wiesner, linux-kernel

The following variables are only written during early boot or __init
functions and remain read-only at runtime:

 - hpet_blockid: set once in acpi_parse_hpet() (__init)
 - hpet_msi_disable: set only in force_disable_hpet_msi() (early PCI quirk)
 - hpet_freq: set only in hpet_enable() (__init)
 - boot_hpet_disable: set only in force_disable_hpet() (early-quirks.c)
   and __init setup functions (hpet_setup(), disable_hpet(),
   hpet_is_pc10_damaged())

Mark them as __ro_after_init to protect them against unintended runtime
modifications.

Signed-off-by: Habil Eren Türker <habilerenturker@hotmail.com>
---
 arch/x86/kernel/hpet.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 0edf0fe0ac2b..681660b8e548 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -51,8 +51,8 @@ struct hpet_base {
  * HPET address is set in acpi/boot.c, when an ACPI entry exists
  */
 unsigned long				hpet_address;
-u8					hpet_blockid; /* OS timer block num */
-bool					hpet_msi_disable;
+u8					hpet_blockid __ro_after_init; /* OS timer block num */
+bool					hpet_msi_disable __ro_after_init;
 
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
 static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel);
@@ -64,9 +64,9 @@ static void __iomem			*hpet_virt_address;
 static struct hpet_base			hpet_base;
 
 static bool				hpet_legacy_int_enabled;
-static unsigned long			hpet_freq;
+static unsigned long			hpet_freq __ro_after_init;
 
-bool					boot_hpet_disable;
+bool					boot_hpet_disable __ro_after_init;
 bool					hpet_force_user;
 static bool				hpet_verbose;
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-19 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 12:29 [PATCH] x86/hpet: Mark boot-time variables as __ro_after_init Habil Eren Türker
2026-11-19 19:40 ` Dave Hansen
2026-11-19 20:37   ` Habil Eren Türker
2026-11-19 22:44     ` Dave Hansen
2026-11-19 23:02       ` Habil Eren Türker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®