Skip to content

Commit

Permalink
platform: ace: notifying about idle thread readiness
Browse files Browse the repository at this point in the history
Informing the primary core that the Idle thread on secondary core is
ready. During the D3 exit flow thread is not initialize again, but
restored from previously saved context.

This patch includes also zephyr version update to aba3b12e31 (total 15
commits). Changes related to intel_adsp contain refactor and fixes for
ACE secondary cores power flows.

Signed-off-by: Tomasz Leman <[email protected]>
  • Loading branch information
tmleman authored and kv2019i committed May 11, 2023
1 parent a048951 commit 93947f9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/platform/intel/ace/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <ipc/info.h>
#include <kernel/abi.h>
#include <rtos/clk.h>
#include <sof/lib/cpu.h>

#include <sof_versions.h>
#include <stdint.h>
Expand Down Expand Up @@ -74,6 +75,11 @@ int platform_boot_complete(uint32_t boot_message)
return ipc_platform_send_msg(&msg);
}

static struct pm_notifier pm_state_notifier = {
.state_entry = NULL,
.state_exit = cpu_notify_state_exit,
};

/* Runs on the primary core only */
int platform_init(struct sof *sof)
{
Expand Down Expand Up @@ -114,6 +120,9 @@ int platform_init(struct sof *sof)
if (ret < 0)
return ret;

/* register power states entry / exit notifiers */
pm_notifier_register(&pm_state_notifier);

/* initialize the host IPC mechanisms */
trace_point(TRACE_BOOT_PLATFORM_IPC);
ipc_init(sof);
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ manifest:

- name: zephyr
repo-path: zephyr
revision: 3e02d48e4ead9978d10ee760c640bf55873f6e95
revision: aba3b12e311b4779338406fe3e7c4c54f655d0cd
remote: zephyrproject

# Import some projects listed in zephyr/west.yml@revision
Expand Down
10 changes: 8 additions & 2 deletions zephyr/include/sof/lib/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@

#include <stdbool.h>

//#include <zephyr/sys/arch_interface.h>

#include <zephyr/arch/arch_inlines.h>

#if CONFIG_PM

#include <zephyr/pm/pm.h>

void cpu_notify_state_exit(enum pm_state state);

#endif /* CONFIG_PM */

/* let the compiler optimise when in single core mode */
#if CONFIG_MULTICORE && CONFIG_SMP

Expand Down
16 changes: 15 additions & 1 deletion zephyr/lib/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,26 @@ static FUNC_NORETURN void secondary_init(void *arg)
#if CONFIG_ZEPHYR_NATIVE_DRIVERS
#include <sof/trace/trace.h>
#include <rtos/wait.h>
#include <zephyr/pm/pm.h>

LOG_MODULE_DECLARE(zephyr, CONFIG_SOF_LOG_LEVEL);

extern struct tr_ctx zephyr_tr;

/* notifier called after every power state transition */
void cpu_notify_state_exit(enum pm_state state)
{
if (state == PM_STATE_SOFT_OFF) {
#if CONFIG_MULTICORE
if (!cpu_is_primary(arch_proc_id())) {
/* Notifying primary core that secondary core successfully exit the D3
* state and is back in the Idle thread.
*/
atomic_set(&ready_flag, 1);
}
#endif
}
}

int cpu_enable_core(int id)
{
/* only called from single core, no RMW lock */
Expand Down

0 comments on commit 93947f9

Please sign in to comment.