-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: introduce a system work queue, use it for EDF
Currently the EDF scheduler under Zephyr defines a delayed work queue to be run on the primary core. However such a work queue will be useful to multiple subsystems. Extract it from the EDF scheduler and make it globally available. Signed-off-by: Guennadi Liakhovetski <[email protected]>
- Loading branch information
Showing
5 changed files
with
51 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
/* | ||
* Copyright(c) 2025 Intel Corporation. | ||
*/ | ||
|
||
#include <zephyr/arch/cpu.h> | ||
#include <zephyr/kernel.h> | ||
|
||
#include <sof/lib/cpu.h> | ||
|
||
static struct k_work_q sof_prime_wq; | ||
static K_THREAD_STACK_DEFINE(sof_prime_wq_stack, CONFIG_SOF_PRIMARY_WQ_STACK_SZ); | ||
static atomic_val_t sof_prime_wq_init; | ||
|
||
void sof_primary_wq_reschedule(struct k_work_delayable *dwork, k_timeout_t delay) | ||
{ | ||
k_work_schedule_for_queue(&sof_prime_wq, dwork, delay); | ||
} | ||
|
||
void sof_primary_wq_init(void) | ||
{ | ||
if (atomic_set(&sof_prime_wq_init, 1)) | ||
return; | ||
|
||
struct k_thread *thread = &sof_prime_wq.thread; | ||
|
||
k_work_queue_start(&sof_prime_wq, sof_prime_wq_stack, | ||
K_THREAD_STACK_SIZEOF(sof_prime_wq_stack), 1, NULL); | ||
|
||
k_thread_suspend(thread); | ||
|
||
k_thread_cpu_pin(thread, PLATFORM_PRIMARY_CORE_ID); | ||
k_thread_name_set(thread, "sof_prime_wq"); | ||
|
||
k_thread_resume(thread); | ||
} |