-
Notifications
You must be signed in to change notification settings - Fork 349
platform: ace: notifying about idle thread readiness #7174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 */ | ||
|
|
@@ -79,7 +93,13 @@ int cpu_enable_core(int id) | |
| return 0; | ||
|
|
||
| #if ZEPHYR_VERSION(3, 0, 99) <= ZEPHYR_VERSION_CODE | ||
tmleman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| z_init_cpu(id); | ||
| /* During kernel initialization, the next pm state is set to ACTIVE. By checking this | ||
| * value, we determine if this is the first core boot, if not, we need to skip idle thread | ||
| * initialization. By reinitializing the idle thread, we would overwrite the kernel structs | ||
| * and the idle thread stack. | ||
| */ | ||
| if (pm_state_next_get(id)->state == PM_STATE_ACTIVE) | ||
| z_init_cpu(id); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given this is an open-coded of z_smp_start_cpu() (see comment above), I don't fully understand why we have a different implementation here, and if this is correct, why this is not needed in the Zephyr kernel/smp.c version. Wouldn't the same problem be there? Or is this specific to a configuration where state is saved to persistant memory? If yes, this would need to be ifdef'ed out so this applies only to applicable platforms.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how zephyr is handling it but right now it's not working properly. After secondary core exits D3 it will repeat the path that led him to this state. Power will not be shut off so eventually it will return to the Idle state but this is not correct behavior. Maybe zephyr doesn't support situation in which each core can be turned off and on multiple times.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| #endif | ||
|
|
||
| atomic_clear(&start_flag); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.