diff --git a/src/include/sof/ipc/common.h b/src/include/sof/ipc/common.h index 43ad023da1ef..562739ffb5c9 100644 --- a/src/include/sof/ipc/common.h +++ b/src/include/sof/ipc/common.h @@ -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 */ diff --git a/src/ipc/ipc-common.c b/src/ipc/ipc-common.c index 244a218d5be8..8f72ac1ba91b 100644 --- a/src/ipc/ipc-common.c +++ b/src/ipc/ipc-common.c @@ -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) diff --git a/src/ipc/ipc-zephyr.c b/src/ipc/ipc-zephyr.c index a410e03123d6..fc2eac10166c 100644 --- a/src/ipc/ipc-zephyr.c +++ b/src/ipc/ipc-zephyr.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -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 */ @@ -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 */ diff --git a/src/schedule/Kconfig b/src/schedule/Kconfig index 02a56b0233e7..99ca2861f650 100644 --- a/src/schedule/Kconfig +++ b/src/schedule/Kconfig @@ -63,3 +63,10 @@ config ZEPHYR_TWB_SCHEDULER Enable Tasks with Budget preemptive scheduler based on 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.