Skip to content

Commit

Permalink
intel_adsp: ace: call soc_num_cpus_init early
Browse files Browse the repository at this point in the history
Restore order of execution. Code that was run in EARLY init level is now
too late.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Aug 5, 2024
1 parent 72995d3 commit dbdcb4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions arch/xtensa/core/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

extern FUNC_NORETURN void z_cstart(void);

/* defined by the SoC in case of CONFIG_SOC_HAS_RUNTIME_NUM_CPUS=y */
extern void soc_num_cpus_init(void);

/**
*
* @brief Prepare to and run C code
Expand All @@ -17,6 +20,10 @@ extern FUNC_NORETURN void z_cstart(void);
*/
void z_prep_c(void)
{
#if CONFIG_SOC_HAS_RUNTIME_NUM_CPUS
soc_num_cpus_init();
#endif

_cpu_t *cpu0 = &_kernel.cpus[0];

#ifdef CONFIG_KERNEL_COHERENCE
Expand Down
4 changes: 1 addition & 3 deletions soc/intel/intel_adsp/ace/multiprocessing.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ static void ipc_isr(void *arg)

unsigned int soc_num_cpus;

static __imr int soc_num_cpus_init(void)
__imr void soc_num_cpus_init(void)
{
/* Need to set soc_num_cpus early to arch_num_cpus() works properly */
soc_num_cpus = ((sys_read32(DFIDCCP) >> CAP_INST_SHIFT) & CAP_INST_MASK) + 1;
soc_num_cpus = MIN(CONFIG_MP_MAX_NUM_CPUS, soc_num_cpus);

return 0;
}
SYS_INIT(soc_num_cpus_init, EARLY, 1);

void soc_mp_init(void)
{
Expand Down

0 comments on commit dbdcb4e

Please sign in to comment.