Skip to content

Commit 46d02e3

Browse files
author
Jyri Sarha
committed
vregion: call vregion_set_interim() from pipeline_comp_complete()
Move the vregion_set_interim() call from module_prepare() to pipeline_comp_complete(). For DP modules vregion_set_interim() cannot be called from userspace, so call it directly from the pipeline completion path which runs in kernel context. Add a null check for the alloc object before dereferencing it.
1 parent d2460a8 commit 46d02e3

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/audio/module_adapter/module/generic.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,6 @@ int module_prepare(struct processing_module *mod,
503503

504504
comp_dbg(dev, "entry");
505505

506-
/* Switch vregion to interim allocation mode for prepare and beyond */
507-
if (md->resources.alloc && md->resources.alloc->vreg)
508-
vregion_set_interim(md->resources.alloc->vreg);
509-
510506
#if CONFIG_IPC_MAJOR_3
511507
if (mod->priv.state == MODULE_IDLE)
512508
return 0;

src/audio/pipeline/pipeline-graph.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
#include <sof/audio/buffer.h>
99
#include <sof/audio/component_ext.h>
10+
#include <sof/audio/module_adapter/module/generic.h>
1011
#include <sof/audio/pipeline.h>
1112
#include <sof/ipc/msg.h>
13+
#include <sof/lib/vregion.h>
1214
#include <rtos/interrupt.h>
1315
#include <rtos/symbol.h>
1416
#include <rtos/alloc.h>
@@ -287,8 +289,14 @@ static int pipeline_comp_complete(struct comp_dev *current,
287289
* It will be calculated during module prepare operation
288290
* either by the module or to default value based on module's OBS
289291
*/
290-
if (current->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_LL)
292+
if (current->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_LL) {
291293
current->period = ppl_data->p->period;
294+
} else {
295+
struct processing_module *mod = comp_mod(current);
296+
297+
if (mod->priv.resources.alloc)
298+
vregion_set_interim(mod->priv.resources.alloc->vreg);
299+
}
292300

293301
current->priority = ppl_data->p->priority;
294302

0 commit comments

Comments
 (0)