Skip to content

Commit

Permalink
ipc: add kconfig to switch IPC tak scheduler to TWB
Browse files Browse the repository at this point in the history
This will add kconfig option to switch scheduler type for IPC task

Signed-off-by: Adrian Bonislawski <[email protected]>
  • Loading branch information
abonislawski committed Feb 24, 2025
1 parent 7dc0172 commit 8d23266
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/include/sof/ipc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ struct ipc {
struct list_item comp_list; /* list of component devices */

/* processing task */
#if CONFIG_TWB_IPC_TASK
struct task *ipc_task;
#else
struct task ipc_task;
#endif

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* io performance measurement */
Expand Down
4 changes: 4 additions & 0 deletions src/ipc/ipc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ static void ipc_work_handler(struct k_work *work)

void ipc_schedule_process(struct ipc *ipc)
{
#if CONFIG_TWB_IPC_TASK
schedule_task(ipc->ipc_task, 0, IPC_PERIOD_USEC);
#else
schedule_task(&ipc->ipc_task, 0, IPC_PERIOD_USEC);
#endif
}

int ipc_init(struct sof *sof)
Expand Down
15 changes: 13 additions & 2 deletions src/ipc/ipc-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <sof/list.h>
#include <sof/platform.h>
#include <sof/schedule/edf_schedule.h>
#include <sof/schedule/twb_schedule.h>
#include <sof/schedule/schedule.h>
#include <rtos/task.h>
#include <rtos/spinlock.h>
Expand Down Expand Up @@ -160,9 +161,14 @@ static int ipc_device_resume_handler(const struct device *dev, void *arg)
intel_adsp_ipc_set_message_handler(INTEL_ADSP_IPC_HOST_DEV, message_handler, ipc);

/* schedule task */
#if CONFIG_TWB_IPC_TASK
scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
&ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE,
CONFIG_TWB_THREAD_MEDIUM_PRIORITY, ZEPHYR_TWB_BUDGET_MAX / 2);
#else
schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
&ipc_task_ops, ipc, 0, 0);

#endif
return 0;
}
#endif /* CONFIG_PM_DEVICE */
Expand Down Expand Up @@ -278,9 +284,14 @@ int platform_ipc_init(struct ipc *ipc)
ipc_set_drvdata(ipc, NULL);

/* schedule task */
#if CONFIG_TWB_IPC_TASK
scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
&ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE,
CONFIG_TWB_THREAD_MEDIUM_PRIORITY, ZEPHYR_TWB_BUDGET_MAX / 2);
#else
schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
&ipc_task_ops, ipc, 0, 0);

#endif
/* configure interrupt - work is done internally by Zephyr API */

/* attach handlers */
Expand Down
7 changes: 7 additions & 0 deletions zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ config ZEPHYR_TWB_SCHEDULER
Zephyr preemptive threads for each SOF task that has pre-allocated
MCPS budget renewed with every system tick.

config TWB_IPC_TASK
bool "use TWB scheduler for IPC task"
default n
depends on ZEPHYR_TWB_SCHEDULER
help
Switch IPC task to TWB scheduler.

config CROSS_CORE_STREAM
bool "Enable cross-core connected pipelines"
default y if IPC_MAJOR_4
Expand Down

0 comments on commit 8d23266

Please sign in to comment.