zephyr: use z_init_cpu() if Zephyr 3.0.99 or newer

Use the new interface to initialize non-primary cores before
enabling them with arch_start_cpu(). This interface is not
available in Zephyr 3.0.0, but is mandatory in later release.

Depends on Zephyr commit 2b210cb3db05 ("kernel: Refactor SMP cpu
initialization a bit").

BugLink: https://github.com/thesofproject/sof/issues/5456
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Kai Vehmanen 2022-01-31 23:47:38 +02:00 committed by Liam Girdwood
parent 760f5ddea2
commit f1e3c934f0
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include <device.h> #include <device.h>
#include <soc.h> #include <soc.h>
#include <kernel.h> #include <kernel.h>
#include <version.h>
#if !CONFIG_KERNEL_COHERENCE #if !CONFIG_KERNEL_COHERENCE
#include <arch/xtensa/cache.h> #include <arch/xtensa/cache.h>
@ -768,6 +769,10 @@ int z_wrapper_cpu_enable_secondary_core(int id)
if (arch_cpu_active(id)) if (arch_cpu_active(id))
return 0; return 0;
#if ZEPHYR_VERSION(3, 0, 99) <= ZEPHYR_VERSION_CODE
z_init_cpu(id);
#endif
atomic_clear(&start_flag); atomic_clear(&start_flag);
atomic_clear(&ready_flag); atomic_clear(&ready_flag);