-/* $OpenBSD: clock.c,v 1.30 2023/08/23 01:55:45 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.31 2023/09/17 14:50:50 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */
/*
stathz = hz;
profhz = stathz;
- clockintr_init(0);
}
void
-/* $OpenBSD: lapic.c,v 1.70 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.71 2023/09/17 14:50:50 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
}
-/* $OpenBSD: clock.c,v 1.41 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.42 2023/09/17 14:50:50 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*-
stathz = 128;
profhz = 1024; /* XXX does not divide into 1 billion */
- clockintr_init(0);
}
void
-/* $OpenBSD: agtimer.c,v 1.20 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.21 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
-/* $OpenBSD: amptimer.c,v 1.19 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: amptimer.c,v 1.20 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
stathz = hz;
profhz = hz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
if (sc->sc_ticks_per_second != amptimer_frequency) {
amptimer_set_clockrate(amptimer_frequency);
-/* $OpenBSD: agtimer.c,v 1.27 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.28 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
if (sc->sc_ticks_per_second != agtimer_frequency) {
agtimer_set_clockrate(agtimer_frequency);
-/* $OpenBSD: dmtimer.c,v 1.21 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: dmtimer.c,v 1.22 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
sc->sc_ticks_per_second = TIMER_FREQUENCY; /* 32768 */
sc->sc_nsec_cycle_ratio =
-/* $OpenBSD: gptimer.c,v 1.22 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: gptimer.c,v 1.23 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
stathz = hz;
profhz = stathz * 10;
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;
-/* $OpenBSD: sxitimer.c,v 1.23 2023/09/14 19:39:47 cheloha Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.24 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
/* stop timer, and set clk src */
bus_space_write_4(sxitimer_iot, sxitimer_ioh,
-/* $OpenBSD: clock.c,v 1.38 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.39 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
stathz = hz;
profhz = stathz * 10;
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;
-/* $OpenBSD: lapic.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.58 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
}
extern int gettick(void); /* XXX put in header file */
-/* $OpenBSD: clock.c,v 1.67 2023/08/23 01:55:46 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.68 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */
/*-
stathz = 128;
profhz = 1024; /* XXX does not divide into 1 billion */
- clockintr_init(0);
}
void
-/* $OpenBSD: glxclk.c,v 1.10 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: glxclk.c,v 1.11 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2013 Paul Irofti.
statclock_is_randomized = 1;
tick = 1000000 / hz;
tick_nsec = 1000000000 / hz;
-
- clockintr_init(0);
}
void
-/* $OpenBSD: clock.c,v 1.18 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.19 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.2 2000/01/11 10:29:35 nisimura Exp $ */
/*
stathz = hz;
profhz = stathz;
- clockintr_init(0);
}
void
-/* $OpenBSD: clock.c,v 1.57 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.58 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
stathz = hz;
profhz = stathz * 10;
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;
-/* $OpenBSD: clock.c,v 1.52 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.53 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
}
/*
-/* $OpenBSD: clock.c,v 1.13 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.14 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
evcount_attach(&clock_count, "clock", NULL);
}
-/* $OpenBSD: clock.c,v 1.12 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.13 2023/09/17 14:50:51 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
riscv_intc_intr_establish(IRQ_TIMER_SUPERVISOR, 0,
clock_intr, NULL, NULL);
-/* $OpenBSD: clock.c,v 1.16 2023/08/23 01:55:47 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.17 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */
/*-
stathz = hz;
profhz = stathz;
- clockintr_init(0);
}
void
-/* $OpenBSD: clock.c,v 1.81 2023/09/14 19:39:48 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.82 2023/09/17 14:50:51 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
stathz = hz;
profhz = stathz * 10;
statclock_is_randomized = 1;
- clockintr_init(0);
/* Make sure we have a sane cpu_clockrate -- we'll need it */
if (!cpu_clockrate)
-/* $OpenBSD: kern_clockintr.c,v 1.53 2023/09/15 11:48:49 deraadt Exp $ */
+/* $OpenBSD: kern_clockintr.c,v 1.54 2023/09/17 14:50:50 cheloha Exp $ */
/*
* Copyright (c) 2003 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
#include <sys/sysctl.h>
#include <sys/time.h>
-/*
- * Protection for global variables in this file:
- *
- * I Immutable after initialization.
- */
-uint32_t clockintr_flags; /* [I] global state + behavior flags */
-
void clockintr_hardclock(struct clockintr *, void *, void *);
void clockintr_schedule(struct clockintr *, uint64_t);
void clockintr_schedule_locked(struct clockintr *, uint64_t);
void clockqueue_reset_intrclock(struct clockintr_queue *);
uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t);
-/*
- * Initialize global state. Set flags and compute intervals.
- */
-void
-clockintr_init(uint32_t flags)
-{
- KASSERT(CPU_IS_PRIMARY(curcpu()));
- KASSERT(clockintr_flags == 0);
- KASSERT(!ISSET(flags, ~CL_FLAG_MASK));
-
- SET(clockintr_flags, flags | CL_INIT);
-}
-
/*
* Ready the calling CPU for clockintr_dispatch(). If this is our
* first time here, install the intrclock, if any, and set necessary
struct schedstate_percpu *spc = &ci->ci_schedstate;
int reset_cq_intrclock = 0;
- KASSERT(ISSET(clockintr_flags, CL_INIT));
-
if (ic != NULL)
clockqueue_intrclock_install(cq, ic);
-/* $OpenBSD: clockintr.h,v 1.17 2023/09/15 11:48:48 deraadt Exp $ */
+/* $OpenBSD: clockintr.h,v 1.18 2023/09/17 14:50:50 cheloha Exp $ */
/*
* Copyright (c) 2020-2022 Scott Cheloha <cheloha@openbsd.org>
*
#define CQ_INTRCLOCK 0x00000002 /* intrclock installed */
#define CQ_STATE_MASK 0x00000003
-/* Global state flags. */
-#define CL_INIT 0x00000001 /* global init done */
-#define CL_STATE_MASK 0x00000001
-
-/* Global behavior flags. */
-#define CL_FLAG_MASK 0x00000000
-
void clockintr_cpu_init(const struct intrclock *);
int clockintr_dispatch(void *);
-void clockintr_init(uint32_t);
void clockintr_trigger(void);
/*