arch: initialize irq_offload during boot, do not use SYS_INIT

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>
This commit is contained in:
Anas Nashif 2024-07-08 17:08:30 -04:00
commit 7e225efab7
14 changed files with 49 additions and 13 deletions

View file

@ -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);
@ -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);

View file

@ -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

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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);

View file

@ -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)
{
}

View file

@ -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 */
/** @} */

View file

@ -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();