Skip to content

Commit 8b45418

Browse files
committed
use RTIO to signal DP audio and IPCs
We should be able to run DP threads in user-space mode, for this we need to move audio and IPC signalling to RTIO. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent e9f0be1 commit 8b45418

File tree

8 files changed

+319
-68
lines changed

8 files changed

+319
-68
lines changed

app/boards/intel_adsp_ace30_ptl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ CONFIG_LLEXT=y
6363
CONFIG_LLEXT_STORAGE_WRITABLE=y
6464
CONFIG_LLEXT_EXPERIMENTAL=y
6565
CONFIG_MODULES=y
66+
CONFIG_RTIO=y
6667

6768
# Zephyr / device drivers
6869
CONFIG_CLOCK_CONTROL=y

src/audio/module_adapter/module/generic.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
*/
1313

1414
#include <rtos/symbol.h>
15-
1615
#include <sof/audio/module_adapter/module/generic.h>
16+
#include <sof/schedule/dp_schedule.h>
1717

1818
LOG_MODULE_DECLARE(module_adapter, CONFIG_SOF_LOG_LEVEL);
1919

@@ -366,9 +366,7 @@ int module_reset(struct processing_module *mod)
366366
if (md->state < MODULE_IDLE)
367367
return 0;
368368
#endif
369-
/* cancel task if DP task*/
370-
if (mod->dev->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP && mod->dev->task)
371-
schedule_task_cancel(mod->dev->task);
369+
372370
if (ops->reset) {
373371
ret = ops->reset(mod);
374372
if (ret) {
@@ -423,7 +421,7 @@ int module_free(struct processing_module *mod)
423421
struct module_data *md = &mod->priv;
424422
int ret = 0;
425423

426-
if (ops->free) {
424+
if (ops->free && mod->dev->ipc_config.proc_domain != COMP_PROCESSING_DOMAIN_DP) {
427425
ret = ops->free(mod);
428426
if (ret)
429427
comp_warn(mod->dev, "error: %d for %d",
@@ -570,7 +568,12 @@ int module_bind(struct processing_module *mod, struct bind_info *bind_data)
570568
if (ret)
571569
return ret;
572570

573-
if (ops->bind)
571+
if (mod->dev->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP) {
572+
union scheduler_dp_rtio_ipc_param param = {
573+
.bind_data = bind_data,
574+
};
575+
ret = scheduler_dp_rtio_ipc(mod, SOF_IPC4_MOD_BIND, &param);
576+
} else if (ops->bind)
574577
ret = ops->bind(mod, bind_data);
575578

576579
return ret;

src/audio/module_adapter/module_adapter.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <sof/audio/source_api.h>
1919
#include <sof/audio/audio_buffer.h>
2020
#include <sof/audio/pipeline.h>
21+
#include <sof/schedule/dp_schedule.h>
2122
#include <sof/schedule/ll_schedule_domain.h>
2223
#include <sof/common.h>
2324
#include <sof/platform.h>
@@ -1261,8 +1262,11 @@ void module_adapter_free(struct comp_dev *dev)
12611262

12621263
comp_dbg(dev, "start");
12631264

1264-
if (dev->task)
1265+
if (dev->task) {
1266+
/* Run DP module's .free() method in its thread context */
1267+
scheduler_dp_rtio_ipc(mod, SOF_IPC4_MOD_DELETE_INSTANCE, NULL);
12651268
schedule_task_cancel(dev->task);
1269+
}
12661270

12671271
ret = module_free(mod);
12681272
if (ret)

src/audio/pipeline/pipeline-stream.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <sof/audio/module_adapter/module/generic.h>
2323
#include <sof/lib/cpu-clk-manager.h>
2424
#include <sof/ipc/notification_pool.h>
25+
#include <sof/schedule/dp_schedule.h>
2526

2627
#ifdef CONFIG_IPC_MAJOR_4
2728
#include <ipc4/notification.h>
@@ -532,6 +533,10 @@ static int pipeline_comp_trigger(struct comp_dev *current,
532533

533534
/* send command to the component and update pipeline state */
534535
err = comp_trigger(current, ppl_data->cmd);
536+
if (current->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP)
537+
/* Process DP module's trigger */
538+
scheduler_dp_rtio_ipc(current->mod, SOF_IPC4_GLB_SET_PIPELINE_STATE, NULL);
539+
535540
switch (err) {
536541
case 0:
537542
break;

src/include/module/module/base.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ enum module_processing_type {
7070
MODULE_PROCESS_TYPE_RAW,
7171
};
7272

73+
struct rtio_sqe;
74+
7375
/*
7476
* A pointer to this structure is passed to module API functions (from struct module_interface).
7577
* This structure should contain only fields that should be available to a module.
@@ -103,6 +105,10 @@ struct processing_module {
103105
uint32_t num_of_sources;
104106
uint32_t num_of_sinks;
105107

108+
/* DP module RTIO SQE pointers, used to signal module's DP thread */
109+
struct rtio_sqe *ipc_sqe;
110+
struct rtio_sqe *audio_sqe;
111+
106112
/* sink and source handlers for the module */
107113
struct sof_sink *sinks[CONFIG_MODULE_MAX_CONNECTIONS];
108114
struct sof_source *sources[CONFIG_MODULE_MAX_CONNECTIONS];

src/include/sof/audio/component_ext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ static inline void comp_free(struct comp_dev *dev)
4646
{
4747
assert(dev->drv->ops.free);
4848

49+
dev->drv->ops.free(dev);
50+
4951
/* free task if shared component or DP task*/
5052
if ((dev->is_shared || dev->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP) &&
5153
dev->task) {
5254
schedule_task_free(dev->task);
5355
rfree(dev->task);
5456
dev->task = NULL;
5557
}
56-
57-
dev->drv->ops.free(dev);
5858
}
5959

6060
/**

src/include/sof/schedule/dp_schedule.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,12 @@ int scheduler_dp_task_init(struct task **task,
8484
void scheduler_get_task_info_dp(struct scheduler_props *scheduler_props,
8585
uint32_t *data_off_size);
8686

87+
struct bind_info;
88+
union scheduler_dp_rtio_ipc_param {
89+
struct bind_info *bind_data;
90+
};
91+
92+
int scheduler_dp_rtio_ipc(struct processing_module *pmod, enum sof_ipc4_module_type cmd,
93+
union scheduler_dp_rtio_ipc_param *param);
94+
8795
#endif /* __SOF_SCHEDULE_DP_SCHEDULE_H__ */

0 commit comments

Comments
 (0)