Skip to content

Commit 264b17e

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 ba3a903 commit 264b17e

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
@@ -222,22 +222,35 @@ static enum task_state scheduler_dp_ll_tick_dummy(void *data)
222222
* needed 1.2ms for processing - but the example would be too complicated)
223223
*/
224224

225-
void scheduler_dp_ll_tick(void)
225+
void z_impl_scheduler_dp_ll_tick(unsigned int core)
226226
{
227227
unsigned int lock_key;
228+
#ifndef CONFIG_SOF_USERSPACE_LL
228229
struct scheduler_dp_data *dp_sch = scheduler_get_data(SOF_SCHEDULE_DP);
230+
#else
231+
struct scheduler_dp_data *dp_sch = scheduler_get_data_for_core(SOF_SCHEDULE_DP, core);
232+
#endif
229233

230234
if (!dp_sch)
231235
return;
232236

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

236-
lock_key = scheduler_dp_lock(cpu_get_id());
240+
lock_key = scheduler_dp_lock(core);
237241
scheduler_dp_recalculate(dp_sch);
238242
scheduler_dp_unlock(lock_key);
239243
}
240244

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

src/schedule/zephyr_ll.c

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

345345
zephyr_ll_unlock(sch, &flags);
346346

347-
scheduler_dp_ll_tick();
347+
scheduler_dp_ll_tick(sch->core);
348348
}
349349

350350
static void schedule_ll_callback(void *data)

zephyr/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/vregion.h)
631631
zephyr_library_sources(syscall/vregion.c)
632632
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib/dai-zephyr.h)
633633
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/lib_manager.h)
634+
zephyr_syscall_header(${SOF_SRC_PATH}/include/sof/schedule/dp_schedule.h)
634635
zephyr_library_sources_ifdef(CONFIG_USERSPACE syscall/dai.c)
635636

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

0 commit comments

Comments
 (0)