diff --git a/drivers/timer/cavs_timer.c b/drivers/timer/cavs_timer.c index cd7b217ce5b..46c80271d38 100644 --- a/drivers/timer/cavs_timer.c +++ b/drivers/timer/cavs_timer.c @@ -88,7 +88,7 @@ static void compare_isr(const void *arg) curr = count(); #ifdef CONFIG_SMP - /* If it has been too long since last_count, + /* If we are too soon since last_count, * this interrupt is likely the same interrupt * event but being processed by another CPU. * Since it has already been processed and @@ -121,6 +121,7 @@ static void compare_isr(const void *arg) sys_clock_announce(dticks); } +/* Runs on core 0 only */ int sys_clock_driver_init(const struct device *dev) { uint64_t curr = count(); @@ -181,7 +182,8 @@ uint32_t sys_clock_cycle_get_32(void) return count32(); } -#if defined(CONFIG_SMP) && CONFIG_MP_NUM_CPUS > 1 +#if defined(CONFIG_SMP) && CONFIG_MP_NUM_CPUS > 1 && !defined(CONFIG_SMP_BOOT_DELAY) +/* Runs on secondary cores */ void smp_timer_init(void) { /* This enables the Timer 0 (or 1) interrupt for CPU n. diff --git a/kernel/include/kernel_internal.h b/kernel/include/kernel_internal.h index e55c73fa6f0..684d87dc07c 100644 --- a/kernel/include/kernel_internal.h +++ b/kernel/include/kernel_internal.h @@ -136,9 +136,13 @@ z_thread_return_value_set_with_data(struct k_thread *thread, thread->base.swap_data = data; } +#ifdef CONFIG_SMP extern void z_smp_init(void); +#if CONFIG_MP_NUM_CPUS > 1 && !defined(CONFIG_SMP_BOOT_DELAY) extern void smp_timer_init(void); +#endif +#endif extern void z_early_boot_rand_get(uint8_t *buf, size_t length);