To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.
Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.
- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:
+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().
+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.
These guidelines will shift in the future, but that's the way things
stand as of *this* commit.
- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().
- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.
- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.
Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.
Thread: https://marc.info/?l=openbsd-tech&m=
169195251322149&w=2
-/* $OpenBSD: clock.c,v 1.29 2023/08/21 15:19:09 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.30 2023/08/23 01:55:45 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.29 2000/06/05 21:47:10 thorpej Exp $ */
/*
stathz = hz;
profhz = stathz;
clockintr_init(0);
+}
+void
+cpu_startclock(void)
+{
clockintr_cpu_init(NULL);
/*
-/* $OpenBSD: lapic.c,v 1.68 2023/04/26 10:52:55 mlarkin Exp $ */
+/* $OpenBSD: lapic.c,v 1.69 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
clockintr_init(CL_RNDSTAT);
-
- lapic_startclock();
}
lapic_per_second * (1ULL << 32) / 1000000000;
lapic_timer_nsec_max = UINT64_MAX / lapic_timer_nsec_cycle_ratio;
initclock_func = lapic_initclocks;
+ startclock_func = lapic_startclock;
}
/*
-/* $OpenBSD: machdep.c,v 1.286 2023/07/27 00:28:25 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.287 2023/08/23 01:55:45 cheloha Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
void (*delay_func)(int) = i8254_delay;
void (*initclock_func)(void) = i8254_initclocks;
+void (*startclock_func)(void) = i8254_start_both_clocks;
/*
* Format of boot information passed to us by 32-bit /boot
(*initclock_func)();
}
+void
+cpu_startclock(void)
+{
+ (*startclock_func)();
+}
+
void
need_resched(struct cpu_info *ci)
{
-/* $OpenBSD: cpu.h,v 1.158 2023/07/27 00:28:24 guenther Exp $ */
+/* $OpenBSD: cpu.h,v 1.159 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
extern void (*cpu_idle_cycle_fcn)(void);
#define cpu_idle_cycle() (*cpu_idle_cycle_fcn)()
#define cpu_idle_leave() do { /* nothing */ } while (0)
+extern void (*initclock_func)(void);
+extern void (*startclock_func)(void);
struct region_descriptor;
void lgdt(struct region_descriptor *);
void proc_trampoline(void);
/* clock.c */
-extern void (*initclock_func)(void);
void startclocks(void);
void rtcinit(void);
void rtcstart(void);
void i8254_delay(int);
void i8254_initclocks(void);
void i8254_startclock(void);
+void i8254_start_both_clocks(void);
void i8254_inittimecounter(void);
void i8254_inittimecounter_simple(void);
-/* $OpenBSD: clock.c,v 1.40 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.41 2023/08/23 01:55:46 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
+i8254_start_both_clocks(void)
+{
clockintr_cpu_init(NULL);
/*
-/* $OpenBSD: agtimer.c,v 1.18 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.19 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
agtimer_cpu_initclocks(void)
{
struct agtimer_softc *sc = agtimer_cd.cd_devs[0];
- uint32_t reg;
stathz = hz;
profhz = stathz * 10;
agtimer_set_clockrate(agtimer_frequency);
}
- clockintr_cpu_init(&agtimer_intrclock);
-
/* Setup secure and non-secure timer IRQs. */
arm_intr_establish_fdt_idx(sc->sc_node, 0, IPL_CLOCK,
agtimer_intr, NULL, "tick");
arm_intr_establish_fdt_idx(sc->sc_node, 1, IPL_CLOCK,
agtimer_intr, NULL, "tick");
-
- reg = agtimer_get_ctrl();
- reg &= ~GTIMER_CNTP_CTL_IMASK;
- reg |= GTIMER_CNTP_CTL_ENABLE;
- agtimer_set_tval(INT32_MAX);
- agtimer_set_ctrl(reg);
-
- clockintr_trigger();
}
void
-/* $OpenBSD: amptimer.c,v 1.17 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: amptimer.c,v 1.18 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
*
/* Enable private timer counter and interrupt. */
bus_space_write_4(sc->sc_iot, sc->sc_pioh, PTIMER_CTRL,
(PTIMER_CTRL_ENABLE | PTIMER_CTRL_IRQEN));
-
- /* Start the clock interrupt cycle. */
- clockintr_cpu_init(&timer_intrclock);
- clockintr_trigger();
}
void
-/* $OpenBSD: cpu.h,v 1.63 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.64 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
__asm volatile ("msr cpsr_c, %0" :: "r"(cpsr));
}
-void cpu_startclock(void);
-
#endif /* _KERNEL */
#ifdef MULTIPROCESSOR
-/* $OpenBSD: agtimer.c,v 1.25 2023/08/11 01:28:19 cheloha Exp $ */
+/* $OpenBSD: agtimer.c,v 1.26 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Patrick Wildt <patrick@blueri.se>
agtimer_cpu_initclocks(void)
{
struct agtimer_softc *sc = agtimer_cd.cd_devs[0];
- uint32_t reg;
- uint64_t kctl;
stathz = hz;
profhz = stathz * 10;
/* configure virtual timer interrupt */
sc->sc_ih = arm_intr_establish_fdt_idx(sc->sc_node, 2,
IPL_CLOCK|IPL_MPSAFE, agtimer_intr, NULL, "tick");
-
- clockintr_cpu_init(&agtimer_intrclock);
-
- reg = agtimer_get_ctrl();
- reg &= ~GTIMER_CNTV_CTL_IMASK;
- reg |= GTIMER_CNTV_CTL_ENABLE;
- agtimer_set_tval(INT32_MAX);
- agtimer_set_ctrl(reg);
-
- clockintr_trigger();
-
- /* enable userland access to virtual counter */
- kctl = READ_SPECIALREG(CNTKCTL_EL1);
- WRITE_SPECIALREG(CNTKCTL_EL1, kctl | CNTKCTL_EL0VCTEN);
}
void
uint64_t kctl;
uint32_t reg;
- arm_intr_route(sc->sc_ih, 1, curcpu());
+ if (!CPU_IS_PRIMARY(curcpu()))
+ arm_intr_route(sc->sc_ih, 1, curcpu());
clockintr_cpu_init(&agtimer_intrclock);
-/* $OpenBSD: cpu.h,v 1.38 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.39 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
*
}
void cpu_halt(void);
-void cpu_startclock(void);
int cpu_suspend_primary(void);
void cpu_resume_secondary(struct cpu_info *);
-/* $OpenBSD: dmtimer.c,v 1.19 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: dmtimer.c,v 1.20 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
void dmtimer_reset_tisr(void);
void dmtimer_wait(int reg);
void dmtimer_cpu_initclocks(void);
+void dmtimer_cpu_startclock(void);
void dmtimer_delay(u_int);
void dmtimer_setstatclockrate(int newhz);
dmtimer_timecounter.tc_priv = sc;
tc_init(&dmtimer_timecounter);
arm_clock_register(dmtimer_cpu_initclocks, dmtimer_delay,
- dmtimer_setstatclockrate, NULL);
+ dmtimer_setstatclockrate, dmtimer_cpu_startclock);
}
else
panic("attaching too many dmtimers at 0x%lx",
bus_space_write_4(sc->sc_iot, sc->sc_ioh[0], DM_TLDR, 0);
bus_space_write_4(sc->sc_iot, sc->sc_ioh[0], DM_TIER, DM_TIER_OVF_EN);
bus_space_write_4(sc->sc_iot, sc->sc_ioh[0], DM_TWER, DM_TWER_OVF_EN);
+}
+void
+dmtimer_cpu_startclock(void)
+{
/* start the clock interrupt cycle */
clockintr_cpu_init(&dmtimer_intrclock);
clockintr_trigger();
-/* $OpenBSD: gptimer.c,v 1.20 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: gptimer.c,v 1.21 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
*
int gptimer_intr(void *frame);
void gptimer_wait(int reg);
void gptimer_cpu_initclocks(void);
+void gptimer_cpu_startclock(void);
void gptimer_delay(u_int);
void gptimer_reset_tisr(void);
void gptimer_setstatclockrate(int newhz);
aa->aa_dev->mem[0].addr);
arm_clock_register(gptimer_cpu_initclocks, gptimer_delay,
- gptimer_setstatclockrate, NULL);
+ gptimer_setstatclockrate, gptimer_cpu_startclock);
}
int
gptimer_wait(GP_TWPS_ALL);
bus_space_write_4(gptimer_iot, gptimer_ioh0, GP_TWER, GP_TWER_OVF_EN);
gptimer_wait(GP_TWPS_ALL);
+}
+void
+gptimer_cpu_startclock(void)
+{
/* start the clock interrupt cycle */
clockintr_cpu_init(&gptimer_intrclock);
clockintr_trigger();
-/* $OpenBSD: sxitimer.c,v 1.21 2023/07/25 18:16:19 cheloha Exp $ */
+/* $OpenBSD: sxitimer.c,v 1.22 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
* Copyright (c) 2013 Raphael Graf <r@undefined.ch>
int sxitimer_tickintr(void *);
int sxitimer_statintr(void *);
void sxitimer_cpu_initclocks(void);
+void sxitimer_cpu_startclock(void);
void sxitimer_setstatclockrate(int);
uint64_t sxitimer_readcnt64(void);
uint32_t sxitimer_readcnt32(void);
tc_init(&sxitimer_timecounter);
arm_clock_register(sxitimer_cpu_initclocks, sxitimer_delay,
- sxitimer_setstatclockrate, NULL);
+ sxitimer_setstatclockrate, sxitimer_cpu_startclock);
printf(": %d kHz", sxitimer_freq[CNTRTIMER] / 1000);
bus_space_write_4(sxitimer_iot, sxitimer_ioh,
TIMER_CTRL(CNTRTIMER),
ctrl | TIMER_ENABLE | TIMER_RELOAD | TIMER_CONTINOUS);
+}
+void
+sxitimer_cpu_startclock(void)
+{
/* start clock interrupt cycle */
clockintr_cpu_init(&sxitimer_intrclock);
clockintr_trigger();
-/* $OpenBSD: clock.c,v 1.36 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.37 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 1998-2003 Michael Shalayeff
itmr_nsec_cycle_ratio = itmr_freq * (1ULL << 32) / 1000000000;
itmr_nsec_max = UINT64_MAX / itmr_nsec_cycle_ratio;
-
- cpu_startclock();
}
void
-/* $OpenBSD: cpu.h,v 1.100 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.101 2023/08/23 01:55:46 cheloha Exp $ */
/*
* Copyright (c) 2000-2004 Michael Shalayeff
void proc_trampoline(void);
int cpu_dumpsize(void);
int cpu_dump(void);
-void cpu_startclock(void);
static inline unsigned int
cpu_rnd_messybits(void)
-/* $OpenBSD: lapic.c,v 1.55 2023/02/09 01:41:15 cheloha Exp $ */
+/* $OpenBSD: lapic.c,v 1.56 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
stathz = hz;
profhz = stathz * 10;
clockintr_init(CL_RNDSTAT);
-
- lapic_startclock();
}
extern int gettick(void); /* XXX put in header file */
lapic_per_second * (1ULL << 32) / 1000000000;
lapic_timer_nsec_max = UINT64_MAX / lapic_timer_nsec_cycle_ratio;
initclock_func = lapic_initclocks;
+ startclock_func = lapic_startclock;
}
/*
-/* $OpenBSD: machdep.c,v 1.668 2023/08/16 09:51:39 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.669 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
void (*delay_func)(int) = i8254_delay;
void (*initclock_func)(void) = i8254_initclocks;
+void (*startclock_func)(void) = i8254_start_both_clocks;
/*
* Extent maps to manage I/O and ISA memory hole space. Allocate
(*initclock_func)(); /* lapic or i8254 */
}
+void
+cpu_startclock(void)
+{
+ (*startclock_func)();
+}
+
void
need_resched(struct cpu_info *ci)
{
-/* $OpenBSD: cpu.h,v 1.182 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.183 2023/08/23 01:55:46 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
extern void (*update_cpuspeed)(void);
+extern void (*initclock_func)(void);
+extern void (*startclock_func)(void);
+
/* machdep.c */
void dumpconf(void);
void cpu_reset(void);
void proc_trampoline(void);
/* clock.c */
-extern void (*initclock_func)(void);
void startclocks(void);
void rtcinit(void);
void rtcstart(void);
void i8254_delay(int);
void i8254_initclocks(void);
void i8254_startclock(void);
+void i8254_start_both_clocks(void);
void i8254_inittimecounter(void);
void i8254_inittimecounter_simple(void);
-/* $OpenBSD: clock.c,v 1.66 2023/08/22 17:13:22 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.67 2023/08/23 01:55:46 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
+i8254_start_both_clocks(void)
+{
clockintr_cpu_init(NULL);
/*
-/* $OpenBSD: clock.c,v 1.17 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.18 2023/08/23 01:55:47 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.2 2000/01/11 10:29:35 nisimura Exp $ */
/*
stathz = hz;
profhz = stathz;
clockintr_init(0);
+}
+void
+cpu_startclock(void)
+{
clockintr_cpu_init(NULL);
clockinitted = 1;
-/* $OpenBSD: clock.c,v 1.55 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.56 2023/08/23 01:55:47 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */
/*
(void) ppc_intr_disable();
}
-void cpu_startclock(void);
-
void
cpu_initclocks(void)
{
evcount_attach(&clk_count, "clock", &clk_irq);
- clock_initialized = 1;
- cpu_startclock();
-
ppc_intr_enable(intrstate);
}
void
cpu_startclock(void)
{
+ clock_initialized = 1;
clockintr_cpu_init(&dec_intrclock);
clockintr_trigger();
}
-/* $OpenBSD: cpu.h,v 1.143 2023/08/05 05:46:36 guenther Exp $ */
+/* $OpenBSD: cpu.h,v 1.144 2023/08/23 01:55:47 cheloha Exp $ */
/*-
* Copyright (c) 1992, 1993
#define CPU_BUSY_CYCLE() do {} while (0)
+extern void (*md_initclock)(void);
extern void (*md_startclock)(struct cpu_info *);
extern void (*md_triggerclock)(void);
void cp0_calibrate(struct cpu_info *);
-/* $OpenBSD: clock.c,v 1.50 2023/01/18 19:12:43 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.51 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
.ic_trigger = cp0_trigger_int5_wrapper
};
+void cp0_initclock(void);
uint32_t cp0_int5(uint32_t, struct trapframe *);
void cp0_startclock(struct cpu_info *);
void cp0_trigger_int5(void);
/* try to avoid getting clock interrupts early */
cp0_set_compare(cp0_get_count() - 1);
+ md_initclock = cp0_initclock;
md_startclock = cp0_startclock;
md_triggerclock = cp0_trigger_int5;
}
cp0_trigger_int5();
}
+void
+cp0_initclock(void)
+{
+ KASSERT(CPU_IS_PRIMARY(curcpu()));
+
+ stathz = hz;
+ profhz = stathz * 10;
+ clockintr_init(CL_RNDSTAT);
+}
+
/*
* Start the clock interrupt dispatch cycle.
*/
{
int s;
- if (CPU_IS_PRIMARY(ci)) {
- stathz = hz;
- profhz = stathz * 10;
- clockintr_init(CL_RNDSTAT);
- } else {
+ if (!CPU_IS_PRIMARY(ci)) {
s = splhigh();
nanouptime(&ci->ci_schedstate.spc_runtime);
splx(s);
-/* $OpenBSD: mips64_machdep.c,v 1.42 2023/07/25 18:16:20 cheloha Exp $ */
+/* $OpenBSD: mips64_machdep.c,v 1.43 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2009, 2010, 2012 Miodrag Vallat.
* Mips machine independent clock routines.
*/
+void (*md_initclock)(void);
void (*md_startclock)(struct cpu_info *);
void (*md_triggerclock)(void);
tc_init(&cp0_timecounter);
}
+ if (md_initclock != NULL)
+ (*md_initclock)();
+}
+
+void
+cpu_startclock(void)
+{
#ifdef DIAGNOSTIC
if (md_startclock == NULL)
panic("no clock");
#endif
- (*md_startclock)(ci);
+ (*md_startclock)(curcpu());
}
void
-/* $OpenBSD: cpu.h,v 1.34 2023/08/21 01:35:43 guenther Exp $ */
+/* $OpenBSD: cpu.h,v 1.35 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
void cpu_kick(struct cpu_info *);
void cpu_unidle(struct cpu_info *);
void cpu_boot_secondary_processors(void);
-void cpu_startclock(void);
extern void (*ul_setperf)(int);
void mp_setperf(int);
-/* $OpenBSD: clock.c,v 1.11 2023/07/25 18:16:21 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.12 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
.tc_user = TC_TB,
};
-void cpu_startclock(void);
-
void
dec_rearm(void *unused, uint64_t nsecs)
{
clockintr_init(CL_RNDSTAT);
evcount_attach(&clock_count, "clock", NULL);
-
- cpu_startclock();
}
void
-/* $OpenBSD: cpu.h,v 1.17 2023/08/05 05:45:52 guenther Exp $ */
+/* $OpenBSD: cpu.h,v 1.18 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2019 Mike Larkin <mlarkin@openbsd.org>
extern struct cpu_info *cpu_info[MAXCPUS];
void cpu_boot_secondary_processors(void);
-void cpu_startclock(void);
#endif /* !MULTIPROCESSOR */
-/* $OpenBSD: clock.c,v 1.10 2023/07/25 18:16:21 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.11 2023/08/23 01:55:47 cheloha Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
.tc_user = TC_TB,
};
-void cpu_startclock(void);
int clock_intr(void *);
void
evcount_attach(&clock_count, "clock", NULL);
evcount_percpu(&clock_count);
-
- cpu_startclock();
}
void
-/* $OpenBSD: clock.c,v 1.15 2023/07/25 18:16:21 cheloha Exp $ */
+/* $OpenBSD: clock.c,v 1.16 2023/08/23 01:55:47 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */
/*-
stathz = hz;
profhz = stathz;
clockintr_init(0);
+}
+void
+cpu_startclock(void)
+{
clockintr_cpu_init(NULL);
/*
-/* $OpenBSD: clock.c,v 1.79 2023/08/07 17:11:13 miod Exp $ */
+/* $OpenBSD: clock.c,v 1.80 2023/08/23 01:55:47 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
for (ci = cpus; ci != NULL; ci = ci->ci_next)
memcpy(&ci->ci_tickintr, &level0, sizeof(level0));
+}
+void
+cpu_startclock(void)
+{
cpu_start_clock();
}
-/* $OpenBSD: kern_clock.c,v 1.114 2023/08/22 13:46:20 jsg Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.115 2023/08/23 01:55:45 cheloha Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
profclock_period = 1000000000 / profhz;
inittimecounter();
+
+ /* Start dispatching clock interrupts on the primary CPU. */
+ cpu_startclock();
}
/*
-/* $OpenBSD: systm.h,v 1.164 2023/08/05 20:07:56 cheloha Exp $ */
+/* $OpenBSD: systm.h,v 1.165 2023/08/23 01:55:45 cheloha Exp $ */
/* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */
/*-
void inittodr(time_t);
void resettodr(void);
void cpu_initclocks(void);
+void cpu_startclock(void);
void startprofclock(struct process *);
void stopprofclock(struct process *);