Skip to content

Commit d6ace2f

Browse files
committed
schedule: userspace: DP: make scheduler_dp_ll_tick() a syscall
scheduler_dp_ll_tick(() has to recalculate DP deadlines and reschedule DP threads. Make it a syscall to be able to call it from the userspace LL scheduler. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 7726142 commit d6ace2f

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/include/sof/schedule/dp_schedule.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ int scheduler_dp_task_init(struct task **task,
7878
uint16_t core,
7979
size_t stack_size,
8080
uint32_t options);
81-
void scheduler_dp_ll_tick(void);
81+
82+
#if defined(__ZEPHYR__) && CONFIG_SOF_FULL_ZEPHYR_APPLICATION
83+
__syscall void scheduler_dp_ll_tick(unsigned int core);
84+
#include <zephyr/syscalls/dp_schedule.h>
85+
#endif
8286

8387
/**
8488
* \brief Extract information about scheduler's tasks

src/schedule/zephyr_dp_schedule.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,35 @@ static enum task_state scheduler_dp_ll_tick_dummy(void *data)
221221
* needed 1.2ms for processing - but the example would be too complicated)
222222
*/
223223

224-
void scheduler_dp_ll_tick(void)
224+
void z_impl_scheduler_dp_ll_tick(unsigned int core)
225225
{
226226
unsigned int lock_key;
227+
#ifndef CONFIG_SOF_USERSPACE_LL
227228
struct scheduler_dp_data *dp_sch = scheduler_get_data(SOF_SCHEDULE_DP);
229+
#else
230+
struct scheduler_dp_data *dp_sch = scheduler_get_data_for_core(SOF_SCHEDULE_DP, core);
231+
#endif
228232

229233
if (!dp_sch)
230234
return;
231235

232236
/* remember current timestamp as "NOW" */
233237
dp_sch->last_ll_tick_timestamp = k_cycle_get_32();
234238

235-
lock_key = scheduler_dp_lock(cpu_get_id());
239+
lock_key = scheduler_dp_lock(core);
236240
scheduler_dp_recalculate(dp_sch);
237241
scheduler_dp_unlock(lock_key);
238242
}
239243

244+
#ifdef CONFIG_USERSPACE
245+
#include <zephyr/internal/syscall_handler.h>
246+
void z_vrfy_scheduler_dp_ll_tick(unsigned int core)
247+
{
248+
z_impl_scheduler_dp_ll_tick(core);
249+
}
250+
#include <zephyr/syscalls/scheduler_dp_ll_tick_mrsh.c>
251+
#endif
252+
240253
#if CONFIG_SOF_USERSPACE_APPLICATION
241254
static int scheduler_dp_task_cancel(void *data, struct task *task)
242255
{

src/schedule/zephyr_ll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ static void zephyr_ll_run(void *data)
304304

305305
zephyr_ll_unlock(sch, &flags);
306306

307-
scheduler_dp_ll_tick();
307+
scheduler_dp_ll_tick(sch->core);
308308
}
309309

310310
static void schedule_ll_callback(void *data)

zephyr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/vregion.h)
629629
zephyr_library_sources(syscall/vregion.c)
630630
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/dai-zephyr.h)
631631
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib_manager.h)
632+
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/schedule/dp_schedule.h)
632633
zephyr_library_sources_ifdef(CONFIG_USERSPACE syscall/dai.c)
633634

634635
zephyr_syscall_header(${SOF_SRC_PATH}/include/user/debug_stream_slot.h)

0 commit comments

Comments
 (0)