Skip to content

Commit

Permalink
arch: initialize irq_offload during boot, do not use SYS_INIT
Browse files Browse the repository at this point in the history
Do not use SYS_INIT for initializing irq_offload when enabled, instead
using a new interface that is called during the boot process for all
architectures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
  • Loading branch information
nashif committed Sep 18, 2024
1 parent c9f7b51 commit 7e225ef
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 13 deletions.
6 changes: 1 addition & 5 deletions arch/arc/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
}

/* need to be executed on every core in the system */
int arc_irq_offload_init(void)
void arch_irq_offload_init(void)
{

IRQ_CONNECT(IRQ_OFFLOAD_LINE, IRQ_OFFLOAD_PRIO, arc_irq_offload_handler, NULL, 0);
Expand All @@ -64,8 +64,4 @@ int arc_irq_offload_init(void)
* with generic irq_enable() but via z_arc_v2_irq_unit_int_enable().
*/
z_arc_v2_irq_unit_int_enable(IRQ_OFFLOAD_LINE);

return 0;
}

SYS_INIT(arc_irq_offload_init, POST_KERNEL, 0);
4 changes: 1 addition & 3 deletions arch/arc/include/arc_irq_offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

#ifdef CONFIG_IRQ_OFFLOAD

int arc_irq_offload_init(const struct device *unused);

static inline void arc_irq_offload_init_smp(void)
{
arc_irq_offload_init(NULL);
arch_irq_offload_init();
}

#else
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
offload_routine = NULL;
k_sched_unlock();
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/arm64/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
: [svid] "i" (_SVC_CALL_IRQ_OFFLOAD),
"r" (x0), "r" (x1));
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/mips/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)

irq_unlock(key);
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/nios2/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)

irq_unlock(key);
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/posix/core/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
{
posix_irq_offload(routine, parameter);
}

void arch_irq_offload_init(void)
{
}
#endif

void arch_irq_enable(unsigned int irq)
Expand Down
4 changes: 4 additions & 0 deletions arch/riscv/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
{
arch_syscall_invoke2((uintptr_t)routine, (uintptr_t)parameter, RV_ECALL_IRQ_OFFLOAD);
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/sparc/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)

irq_unlock(key);
}

void arch_irq_offload_init(void)
{
}
4 changes: 4 additions & 0 deletions arch/x86/core/ia32/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)

irq_unlock(key);
}

void arch_irq_offload_init(void)
{
}
6 changes: 1 addition & 5 deletions arch/x86/core/intel64/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
arch_irq_unlock(key);
}

int irq_offload_init(void)
void arch_irq_offload_init(void)
{
x86_irq_funcs[CONFIG_IRQ_OFFLOAD_VECTOR - IV_IRQS] = dispatcher;

return 0;
}

SYS_INIT(irq_offload_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
4 changes: 4 additions & 0 deletions arch/xtensa/core/irq_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ void arch_irq_offload(irq_offload_routine_t routine, const void *parameter)
:: "r"(intenable), "r"(BIT(ZSR_IRQ_OFFLOAD_INT)));
arch_irq_unlock(key);
}

void arch_irq_offload_init(void)
{
}
7 changes: 7 additions & 0 deletions include/zephyr/arch/arch_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@ bool arch_irq_is_used(unsigned int irq);
* @param parameter Value to pass to the function when invoked
*/
void arch_irq_offload(irq_offload_routine_t routine, const void *parameter);


/**
* Initialize the architecture-specific portion of the irq_offload subsystem
*/
void arch_irq_offload_init(void);

#endif /* CONFIG_IRQ_OFFLOAD */

/** @} */
Expand Down
3 changes: 3 additions & 0 deletions kernel/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ static void bg_thread_main(void *unused1, void *unused2, void *unused3)
#endif /* CONFIG_MMU */
z_sys_post_kernel = true;

#if CONFIG_IRQ_OFFLOAD
arch_irq_offload_init();
#endif
z_sys_init_run_level(INIT_LEVEL_POST_KERNEL);
#if CONFIG_SOC_LATE_INIT_HOOK
soc_late_init_hook();
Expand Down

0 comments on commit 7e225ef

Please sign in to comment.