Skip to content

Commit 93cb105

Browse files
tmlemanabonislawski
authored andcommitted
platform: ace: notifying about idle thread readiness
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. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent 096b2a1 commit 93cb105

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/platform/intel/ace/platform.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <ipc/info.h>
2424
#include <kernel/abi.h>
2525
#include <rtos/clk.h>
26+
#include <zephyr/pm/pm.h>
2627

2728
#include <sof_versions.h>
2829
#include <stdint.h>
@@ -75,6 +76,23 @@ int platform_boot_complete(uint32_t boot_message)
7576

7677
/* Value to be determined experimentaly */
7778
#define BASE_CPS_USAGE 10000
79+
80+
extern void ace_mark_thread_as_ready(void);
81+
82+
/* notifier called after every power state transition */
83+
static void notify_pm_state_exit(enum pm_state state)
84+
{
85+
if (state == PM_STATE_SOFT_OFF) {
86+
if (!cpu_is_primary(arch_proc_id()))
87+
ace_mark_thread_as_ready();
88+
}
89+
}
90+
91+
static struct pm_notifier pm_state_notifier = {
92+
.state_entry = NULL,
93+
.state_exit = notify_pm_state_exit,
94+
};
95+
7896
/* Runs on the primary core only */
7997
int platform_init(struct sof *sof)
8098
{
@@ -102,6 +120,9 @@ int platform_init(struct sof *sof)
102120
if (ret < 0)
103121
return ret;
104122

123+
/* register power states entry / exit notifiers */
124+
pm_notifier_register(&pm_state_notifier);
125+
105126
/* initialize the host IPC mechanisms */
106127
trace_point(TRACE_BOOT_PLATFORM_IPC);
107128
ipc_init(sof);

zephyr/lib/cpu.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ extern K_KERNEL_STACK_ARRAY_DEFINE(z_interrupt_stacks, CONFIG_MP_NUM_CPUS,
2727
static atomic_t start_flag;
2828
static atomic_t ready_flag;
2929

30+
void ace_mark_thread_as_ready(void)
31+
{
32+
atomic_set(&ready_flag, 1);
33+
}
34+
3035
/* Zephyr kernel_internal.h interface */
3136
extern void smp_timer_init(void);
3237

0 commit comments

Comments
 (0)