summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 19:39:49 +0000
committerScott Soule Cheloha <cheloha@cvs.openbsd.org>2023-09-14 19:39:49 +0000
commit23d4dbc72605b1f0fa928f1a867d23f4130148de (patch)
treee6d8a4f068fedbe8cc4c573a15fe4545651d42ff /sys/arch
parent05d6d03a7d1d98b3c545a840954ab5e68b0e9ac7 (diff)
clockintr: replace CL_RNDSTAT with global variable statclock_is_randomized
In order to separate the statclock from the clock interrupt subsystem we need to move all statclock state out into the broader kernel. Start by replacing the CL_RNDSTAT flag with a new global variable, "statclock_is_randomized", in kern_clock.c. Update all clockintr_init() callers to set the boolean instead of passing the flag. Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/lapic.c5
-rw-r--r--sys/arch/arm/cortex/agtimer.c5
-rw-r--r--sys/arch/arm/cortex/amptimer.c5
-rw-r--r--sys/arch/arm64/dev/agtimer.c5
-rw-r--r--sys/arch/armv7/omap/dmtimer.c5
-rw-r--r--sys/arch/armv7/omap/gptimer.c5
-rw-r--r--sys/arch/armv7/sunxi/sxitimer.c5
-rw-r--r--sys/arch/hppa/dev/clock.c5
-rw-r--r--sys/arch/i386/i386/lapic.c5
-rw-r--r--sys/arch/loongson/dev/glxclk.c5
-rw-r--r--sys/arch/macppc/macppc/clock.c5
-rw-r--r--sys/arch/mips64/mips64/clock.c5
-rw-r--r--sys/arch/powerpc64/powerpc64/clock.c5
-rw-r--r--sys/arch/riscv64/riscv64/clock.c5
-rw-r--r--sys/arch/sparc64/sparc64/clock.c5
15 files changed, 45 insertions, 30 deletions
diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c
index 4e7182ecb5e..6f9c2ace887 100644
--- a/sys/arch/amd64/amd64/lapic.c
+++ b/sys/arch/amd64/amd64/lapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lapic.c,v 1.69 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.70 2023/09/14 19:39:47 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
@@ -498,7 +498,8 @@ lapic_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
diff --git a/sys/arch/arm/cortex/agtimer.c b/sys/arch/arm/cortex/agtimer.c
index 88e201abe8a..106cb4804c0 100644
--- a/sys/arch/arm/cortex/agtimer.c
+++ b/sys/arch/arm/cortex/agtimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agtimer.c,v 1.19 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.20 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
@@ -230,7 +230,8 @@ agtimer_cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
diff --git a/sys/arch/arm/cortex/amptimer.c b/sys/arch/arm/cortex/amptimer.c
index 299f9fe8c61..1fb5695c00b 100644
--- a/sys/arch/arm/cortex/amptimer.c
+++ b/sys/arch/arm/cortex/amptimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amptimer.c,v 1.18 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: amptimer.c,v 1.19 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
@@ -287,7 +287,8 @@ amptimer_cpu_initclocks(void)
stathz = hz;
profhz = hz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != amptimer_frequency) {
amptimer_set_clockrate(amptimer_frequency);
diff --git a/sys/arch/arm64/dev/agtimer.c b/sys/arch/arm64/dev/agtimer.c
index 14fb14f0088..12b21c2a79b 100644
--- a/sys/arch/arm64/dev/agtimer.c
+++ b/sys/arch/arm64/dev/agtimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agtimer.c,v 1.26 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.27 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
@@ -293,7 +293,8 @@ agtimer_cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
diff --git a/sys/arch/armv7/omap/dmtimer.c b/sys/arch/armv7/omap/dmtimer.c
index 985428bd6d3..5aaee39405c 100644
--- a/sys/arch/armv7/omap/dmtimer.c
+++ b/sys/arch/armv7/omap/dmtimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmtimer.c,v 1.20 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: dmtimer.c,v 1.21 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
@@ -232,7 +232,8 @@ dmtimer_cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
sc->sc_ticks_per_second = TIMER_FREQUENCY; /* 32768 */
sc->sc_nsec_cycle_ratio =
diff --git a/sys/arch/armv7/omap/gptimer.c b/sys/arch/armv7/omap/gptimer.c
index 72cf3e0566a..8ca887098fd 100644
--- a/sys/arch/armv7/omap/gptimer.c
+++ b/sys/arch/armv7/omap/gptimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gptimer.c,v 1.21 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: gptimer.c,v 1.22 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
@@ -198,7 +198,8 @@ gptimer_cpu_initclocks(void)
{
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
gptimer_nsec_cycle_ratio = TIMER_FREQUENCY * (1ULL << 32) / 1000000000;
gptimer_nsec_max = UINT64_MAX / gptimer_nsec_cycle_ratio;
diff --git a/sys/arch/armv7/sunxi/sxitimer.c b/sys/arch/armv7/sunxi/sxitimer.c
index 81b36f9c23b..9bee18a9e19 100644
--- a/sys/arch/armv7/sunxi/sxitimer.c
+++ b/sys/arch/armv7/sunxi/sxitimer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sxitimer.c,v 1.22 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.23 2023/09/14 19:39:47 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
@@ -180,7 +180,8 @@ sxitimer_attach(struct device *parent, struct device *self, void *aux)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
/* stop timer, and set clk src */
bus_space_write_4(sxitimer_iot, sxitimer_ioh,
diff --git a/sys/arch/hppa/dev/clock.c b/sys/arch/hppa/dev/clock.c
index 2bae218e3c8..3e54c5034ca 100644
--- a/sys/arch/hppa/dev/clock.c
+++ b/sys/arch/hppa/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.37 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.38 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
@@ -116,7 +116,8 @@ cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
itmr_nsec_cycle_ratio = itmr_freq * (1ULL << 32) / 1000000000;
itmr_nsec_max = UINT64_MAX / itmr_nsec_cycle_ratio;
diff --git a/sys/arch/i386/i386/lapic.c b/sys/arch/i386/i386/lapic.c
index 49d9dfcfe89..97cfb45979a 100644
--- a/sys/arch/i386/i386/lapic.c
+++ b/sys/arch/i386/i386/lapic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lapic.c,v 1.56 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
@@ -326,7 +326,8 @@ lapic_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
extern int gettick(void); /* XXX put in header file */
diff --git a/sys/arch/loongson/dev/glxclk.c b/sys/arch/loongson/dev/glxclk.c
index 652462d534f..d3df7cf941c 100644
--- a/sys/arch/loongson/dev/glxclk.c
+++ b/sys/arch/loongson/dev/glxclk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glxclk.c,v 1.9 2023/08/26 09:37:43 visa Exp $ */
+/* $OpenBSD: glxclk.c,v 1.10 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2013 Paul Irofti.
@@ -189,10 +189,11 @@ glxclk_initclock(void)
*/
stathz = hz = 128;
profhz = hz * 10;
+ statclock_is_randomized = 1;
tick = 1000000 / hz;
tick_nsec = 1000000000 / hz;
- clockintr_init(CL_RNDSTAT);
+ clockintr_init(0);
}
void
diff --git a/sys/arch/macppc/macppc/clock.c b/sys/arch/macppc/macppc/clock.c
index 93084b0573a..a9bed56a627 100644
--- a/sys/arch/macppc/macppc/clock.c
+++ b/sys/arch/macppc/macppc/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.56 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
@@ -195,7 +195,8 @@ cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
dec_nsec_cycle_ratio = ticks_per_sec * (1ULL << 32) / 1000000000;
dec_nsec_max = UINT64_MAX / dec_nsec_cycle_ratio;
diff --git a/sys/arch/mips64/mips64/clock.c b/sys/arch/mips64/mips64/clock.c
index afcf68c509b..0afc2e7c73d 100644
--- a/sys/arch/mips64/mips64/clock.c
+++ b/sys/arch/mips64/mips64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.51 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.52 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -241,7 +241,8 @@ cp0_initclock(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
}
/*
diff --git a/sys/arch/powerpc64/powerpc64/clock.c b/sys/arch/powerpc64/powerpc64/clock.c
index 39cab54e93c..7de2ac52c2e 100644
--- a/sys/arch/powerpc64/powerpc64/clock.c
+++ b/sys/arch/powerpc64/powerpc64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.12 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.13 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -94,7 +94,8 @@ cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
evcount_attach(&clock_count, "clock", NULL);
}
diff --git a/sys/arch/riscv64/riscv64/clock.c b/sys/arch/riscv64/riscv64/clock.c
index cd8c8ec6da6..5685e9c4d85 100644
--- a/sys/arch/riscv64/riscv64/clock.c
+++ b/sys/arch/riscv64/riscv64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.11 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.12 2023/09/14 19:39:48 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -92,7 +92,8 @@ cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
riscv_intc_intr_establish(IRQ_TIMER_SUPERVISOR, 0,
clock_intr, NULL, NULL);
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c
index 9255d571a2e..84ec8404d6e 100644
--- a/sys/arch/sparc64/sparc64/clock.c
+++ b/sys/arch/sparc64/sparc64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.80 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.81 2023/09/14 19:39:48 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
@@ -501,7 +501,8 @@ cpu_initclocks(void)
stathz = hz;
profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
+ statclock_is_randomized = 1;
+ clockintr_init(0);
/* Make sure we have a sane cpu_clockrate -- we'll need it */
if (!cpu_clockrate)