Skip to content

Commit ad67a4e

Browse files
committed
ipc: add kconfig to switch IPC task scheduler to TWB
This will add kconfig option to switch scheduler type for IPC task Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent 7dc0172 commit ad67a4e

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

src/include/sof/ipc/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ struct ipc {
6868
struct list_item comp_list; /* list of component devices */
6969

7070
/* processing task */
71+
#if CONFIG_TWB_IPC_TASK
72+
struct task *ipc_task;
73+
#else
7174
struct task ipc_task;
75+
#endif
7276

7377
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
7478
/* io performance measurement */

src/ipc/ipc-common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,11 @@ static void ipc_work_handler(struct k_work *work)
273273

274274
void ipc_schedule_process(struct ipc *ipc)
275275
{
276+
#if CONFIG_TWB_IPC_TASK
277+
schedule_task(ipc->ipc_task, 0, IPC_PERIOD_USEC);
278+
#else
276279
schedule_task(&ipc->ipc_task, 0, IPC_PERIOD_USEC);
280+
#endif
277281
}
278282

279283
int ipc_init(struct sof *sof)

src/ipc/ipc-zephyr.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <sof/list.h>
3232
#include <sof/platform.h>
3333
#include <sof/schedule/edf_schedule.h>
34+
#include <sof/schedule/twb_schedule.h>
3435
#include <sof/schedule/schedule.h>
3536
#include <rtos/task.h>
3637
#include <rtos/spinlock.h>
@@ -160,9 +161,14 @@ static int ipc_device_resume_handler(const struct device *dev, void *arg)
160161
intel_adsp_ipc_set_message_handler(INTEL_ADSP_IPC_HOST_DEV, message_handler, ipc);
161162

162163
/* schedule task */
164+
#if CONFIG_TWB_IPC_TASK
165+
scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
166+
&ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE,
167+
CONFIG_TWB_THREAD_MEDIUM_PRIORITY, ZEPHYR_TWB_BUDGET_MAX / 2);
168+
#else
163169
schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
164170
&ipc_task_ops, ipc, 0, 0);
165-
171+
#endif
166172
return 0;
167173
}
168174
#endif /* CONFIG_PM_DEVICE */
@@ -278,9 +284,14 @@ int platform_ipc_init(struct ipc *ipc)
278284
ipc_set_drvdata(ipc, NULL);
279285

280286
/* schedule task */
287+
#if CONFIG_TWB_IPC_TASK
288+
scheduler_twb_task_init(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
289+
&ipc_task_ops, ipc, 0, "IPC", ZEPHYR_TWB_STACK_SIZE,
290+
CONFIG_TWB_THREAD_MEDIUM_PRIORITY, ZEPHYR_TWB_BUDGET_MAX / 2);
291+
#else
281292
schedule_task_init_edf(&ipc->ipc_task, SOF_UUID(zipc_task_uuid),
282293
&ipc_task_ops, ipc, 0, 0);
283-
294+
#endif
284295
/* configure interrupt - work is done internally by Zephyr API */
285296

286297
/* attach handlers */

zephyr/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ config ZEPHYR_TWB_SCHEDULER
6767
Zephyr preemptive threads for each SOF task that has pre-allocated
6868
MCPS budget renewed with every system tick.
6969

70+
config TWB_IPC_TASK
71+
bool "use TWB scheduler for IPC task"
72+
default n
73+
depends on ZEPHYR_TWB_SCHEDULER
74+
help
75+
Switch IPC task to TWB scheduler.
76+
7077
config CROSS_CORE_STREAM
7178
bool "Enable cross-core connected pipelines"
7279
default y if IPC_MAJOR_4

0 commit comments

Comments
 (0)