Skip to content

Commit 4e1a180

Browse files
committed
audio: pipeline-schedule: make pipeline_schedule_triggered() user safe
Add support to run pipeline_schedule_triggered() in user-space. Use the user_ll_lock/unlock_sched() interface if building with CONFIG_SOF_USERSPACE_LL. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 836c692 commit 4e1a180

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/audio/pipeline/pipeline-schedule.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <sof/lib/agent.h>
1414
#include <sof/list.h>
1515
#include <sof/schedule/ll_schedule.h>
16+
#include <sof/schedule/ll_schedule_domain.h>
1617
#include <sof/schedule/dp_schedule.h>
1718
#include <sof/schedule/schedule.h>
1819
#include <sof/audio/module_adapter/module/generic.h>
@@ -282,7 +283,6 @@ void pipeline_schedule_triggered(struct pipeline_walk_context *ctx,
282283
struct pipeline_data *ppl_data = ctx->comp_data;
283284
struct list_item *tlist;
284285
struct pipeline *p;
285-
uint32_t flags;
286286

287287
#ifdef CONFIG_IPC_MAJOR_4
288288
/*
@@ -295,11 +295,19 @@ void pipeline_schedule_triggered(struct pipeline_walk_context *ctx,
295295
#endif
296296

297297
/*
298-
* Interrupts have to be disabled while adding tasks to or removing them
298+
* Block scheduler execution when adding tasks or removing them
299299
* from the scheduler list. Without that scheduling can begin
300300
* immediately before all pipelines achieved a consistent state.
301301
*/
302+
#ifdef CONFIG_SOF_USERSPACE_LL
303+
int sched_core = ppl_data->start->ipc_config.core;
304+
305+
user_ll_lock_sched(sched_core);
306+
#else
307+
uint32_t flags;
308+
302309
irq_local_disable(flags);
310+
#endif
303311

304312
switch (cmd) {
305313
case COMP_TRIGGER_PAUSE:
@@ -355,8 +363,11 @@ void pipeline_schedule_triggered(struct pipeline_walk_context *ctx,
355363
p->xrun_bytes = 1;
356364
}
357365
}
358-
366+
#ifdef CONFIG_SOF_USERSPACE_LL
367+
user_ll_unlock_sched(sched_core);
368+
#else
359369
irq_local_enable(flags);
370+
#endif
360371
}
361372

362373
int pipeline_comp_ll_task_init(struct pipeline *p)

0 commit comments

Comments
 (0)