Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/include/module/module/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ struct module_interface {
uint8_t *fragment, size_t fragment_size);

/**
* (unused) Set processing mode for the module
* (IADK) Set processing mode for the module
*/
int (*set_processing_mode)(struct processing_module *mod,
enum module_processing_mode mode);

/**
* (unused) Get the current processing mode for the module
* (IADK) Get the current processing mode for the module
*/
enum module_processing_mode (*get_processing_mode)(struct processing_module *mod);

Expand Down
5 changes: 5 additions & 0 deletions src/include/sof/schedule/schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct scheduler_ops {
*/
int (*schedule_task_free)(void *data, struct task *task);

#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
/**
* Frees scheduler's resources.
* @param data Private data of selected scheduler.
Comment on lines 145 to 146
Expand All @@ -149,6 +150,7 @@ struct scheduler_ops {
* This operation is optional.
*/
void (*scheduler_free)(void *data, uint32_t flags);
#endif

/**
* Initializes context
Expand Down Expand Up @@ -309,6 +311,8 @@ static inline int schedule_task_free(struct task *task)
return sch->ops->schedule_task_free(sch->data, task);
}

/* Only used in a stand-alone test and in a testbench test */
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
/** See scheduler_ops::scheduler_free */
static inline void schedule_free(uint32_t flags)
{
Expand All @@ -322,6 +326,7 @@ static inline void schedule_free(uint32_t flags)
sch->ops->scheduler_free(sch->data, flags);
}
}
#endif

/** See scheduler_ops::scheduler_init_context */
static inline struct k_thread *scheduler_init_context(struct task *task)
Expand Down
6 changes: 4 additions & 2 deletions src/init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ static bool check_restore(void)
{
struct idc *idc = *idc_get();
struct notify *notifier = *arch_notify_get();
struct schedulers *schedulers = *arch_schedulers_get();
struct schedulers **schedulers = arch_schedulers_get();
struct schedulers **user_schedulers = arch_user_schedulers_get();

/* check whether basic core structures has been already allocated. If they
* are available in memory, it means that this is not cold boot and memory
* has not been powered off.
*/
return !!idc && !!notifier && !!schedulers;
return !!idc && !!notifier &&
((schedulers && *schedulers) || (user_schedulers && *user_schedulers));
}

static inline int secondary_core_restore(void) { return 0; };
Expand Down
4 changes: 4 additions & 0 deletions src/platform/library/schedule/edf_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ static int schedule_edf_task(void *data, struct task *task, uint64_t start,
return 0;
}

#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
static void edf_scheduler_free(void *data, uint32_t flags)
{
free(data);
}
#endif

static int schedule_edf_task_cancel(void *data, struct task *task)
{
Expand Down Expand Up @@ -83,7 +85,9 @@ static struct scheduler_ops schedule_edf_ops = {
.reschedule_task = NULL,
.schedule_task_cancel = schedule_edf_task_cancel,
.schedule_task_free = schedule_edf_task_free,
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
.scheduler_free = edf_scheduler_free,
#endif
};

int schedule_task_init_edf(struct task *task, const struct sof_uuid_entry *uid,
Expand Down
4 changes: 4 additions & 0 deletions src/platform/library/schedule/ll_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ static int schedule_ll_task(void *data, struct task *task, uint64_t start,
return 0;
}

#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
static void ll_scheduler_free(void *data, uint32_t flags)
{
free(data);
}
#endif

/* TODO: scheduler free and cancel APIs can merge as part of Zephyr */
static int schedule_ll_task_cancel(void *data, struct task *task)
Expand All @@ -96,7 +98,9 @@ static struct scheduler_ops schedule_ll_ops = {
.reschedule_task = NULL,
.schedule_task_cancel = schedule_ll_task_cancel,
.schedule_task_free = schedule_ll_task_free,
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
.scheduler_free = ll_scheduler_free,
#endif
};

int schedule_task_init_ll(struct task *task,
Expand Down
4 changes: 4 additions & 0 deletions src/schedule/ll_schedule_xtos.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ static int reschedule_ll_task(void *data, struct task *task, uint64_t start)
}
#endif

#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
static void scheduler_free_ll(void *data, uint32_t flags)
{
struct ll_schedule_data *sch = data;
Expand All @@ -739,6 +740,7 @@ static void scheduler_free_ll(void *data, uint32_t flags)

irq_local_enable(irq_flags);
}
#endif

static void ll_scheduler_recalculate_tasks(struct ll_schedule_data *sch,
struct clock_notify_data *clk_data)
Expand Down Expand Up @@ -807,6 +809,8 @@ static const struct scheduler_ops schedule_ll_ops = {
.schedule_task_free = schedule_ll_task_free,
.schedule_task_cancel = schedule_ll_task_cancel,
.reschedule_task = reschedule_ll_task,
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
.scheduler_free = scheduler_free_ll,
#endif
.schedule_task_running = NULL,
};
2 changes: 1 addition & 1 deletion src/schedule/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static inline bool scheduler_is_user(int type)
* to user-space and only keep Zephyr scheduler logic in
* kernel
*/
return type == SOF_SCHEDULE_LL_TIMER;
return type == SOF_SCHEDULE_LL_TIMER || type == SOF_SCHEDULE_DP;
}

int schedule_task_init(struct task *task,
Expand Down
5 changes: 3 additions & 2 deletions src/schedule/zephyr_dp_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static int scheduler_dp_task_stop(void *data, struct task *task)
struct task_dp_pdata *pdata = task->priv_data;

/* this is asyn cancel - mark the task as canceled and remove it from scheduling */
lock_key = scheduler_dp_lock(cpu_get_id());
lock_key = scheduler_dp_lock(task->core);

task->state = SOF_TASK_STATE_CANCEL;
list_item_del(&task->list);
Expand Down Expand Up @@ -307,7 +307,7 @@ static int scheduler_dp_task_shedule(void *data, struct task *task, uint64_t sta
struct task_dp_pdata *pdata = task->priv_data;
unsigned int lock_key;

lock_key = scheduler_dp_lock(cpu_get_id());
lock_key = scheduler_dp_lock(task->core);

if (task_is_active(task)) {
scheduler_dp_unlock(lock_key);
Expand Down Expand Up @@ -358,6 +358,7 @@ __cold int scheduler_dp_init(void)
if (!dp_sch)
return -ENOMEM;

dp_sch->ll_tick_src.priv_data = NULL;
list_init(&dp_sch->tasks);

scheduler_init(SOF_SCHEDULE_DP, &schedule_dp_ops, dp_sch);
Expand Down
15 changes: 10 additions & 5 deletions src/schedule/zephyr_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,25 +546,28 @@ static int zephyr_ll_task_cancel(void *data, struct task *task)
return 0;
}

/*
* Runs on secondary cores in their shutdown sequence. In theory tasks can still
* be active, but other schedulers ignore them too... And we don't need to free
* the scheduler data - it's allocated in the SYS zone.
*/
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
static void zephyr_ll_scheduler_free(void *data, uint32_t flags)
{
struct zephyr_ll *sch = data;

zephyr_ll_assert_core(sch);

#if CONFIG_SOF_USERSPACE_LL
zephyr_ll_locks[sch->core] = NULL;
k_object_free(sch->lock);
#endif

if (sch->n_tasks)
tr_err(&ll_tr, "%u tasks are still active!",
sch->n_tasks);

#if CONFIG_SOF_USERSPACE_LL
domain_thread_free(sch->ll_domain, sch->n_tasks);
#endif
sof_heap_free(sch->heap, sch);
}
#endif

#if CONFIG_SOF_USERSPACE_LL
struct k_thread *zephyr_ll_init_context(void *data, struct task *task)
Expand Down Expand Up @@ -601,7 +604,9 @@ static const struct scheduler_ops zephyr_ll_ops = {
.schedule_task_after = zephyr_ll_task_schedule_after,
.schedule_task_free = zephyr_ll_task_free,
.schedule_task_cancel = zephyr_ll_task_cancel,
#if CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY
.scheduler_free = zephyr_ll_scheduler_free,
#endif
#if CONFIG_SOF_USERSPACE_LL
.scheduler_init_context = zephyr_ll_init_context,
#endif
Expand Down
6 changes: 3 additions & 3 deletions zephyr/include/sof/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#define __cold_rodata
#endif

#if CONFIG_COLD_STORE_EXECUTE_DEBUG
#include <rtos/panic.h>

#ifdef __ZEPHYR__
bool ll_sch_is_current(void);
#else
#define ll_sch_is_current() false
#endif

#if CONFIG_COLD_STORE_EXECUTE_DEBUG
#include <rtos/panic.h>

void dbg_path_hot_start_watching(void);
void dbg_path_hot_stop_watching(void);
void dbg_path_hot_confirm(void);
Expand Down
Loading