Skip to content

Commit 81d76d1

Browse files
ipc4: harden IPC4 pipeline triggering logic
Using IPC4_MOD_ID() is not the best way to check if IPC4 is enabled. For module ID == 0, IPC4_MOD_ID() returns 0 for both IPC3 and IPC4. Module ID 0 is a valid IPC4 BASEFW ID. Since BASEFW is never added to a pipeline, this change doesn't fix any real problem. However, it's just more appropriate and safer to use IS_ENABLED(CONFIG_IPC_MAJOR_4): if module ID data becomes corrupted (zeroed) at runtime, this shouldn't make debugging even harder by causing unexpected pipeline behavior. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 60283dc commit 81d76d1

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/audio/pipeline/pipeline-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int pipeline_comp_reset(struct comp_dev *current,
369369
* scheduled together, except for IPC4, where each pipeline receives
370370
* commands from the host separately
371371
*/
372-
if (!is_single_ppl && IPC4_MOD_ID(current->ipc_config.id))
372+
if (!is_single_ppl && IS_ENABLED(CONFIG_IPC_MAJOR_4))
373373
return 0;
374374

375375
/* Propagate reset across pipelines only in the same direction

src/audio/pipeline/pipeline-params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static int pipeline_comp_prepare(struct comp_dev *current,
267267

268268
if (!comp_is_single_pipeline(current, ppl_data->start)) {
269269
/* ipc4 module is only prepared in its parent pipeline */
270-
if (IPC4_MOD_ID(current->ipc_config.id))
270+
if (IS_ENABLED(CONFIG_IPC_MAJOR_4))
271271
return 0;
272272

273273
/* Propagate prepare only to pipelines in the same direction */

src/audio/pipeline/pipeline-schedule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static enum task_state pipeline_task_cmd(struct pipeline *p,
140140
err = SOF_TASK_STATE_RESCHEDULE;
141141
} else if (p->status == COMP_STATE_PAUSED) {
142142
/* reset the pipeline components for IPC4 after the STOP trigger */
143-
if (cmd == COMP_TRIGGER_STOP && IPC4_MOD_ID(host->ipc_config.id)) {
143+
if (cmd == COMP_TRIGGER_STOP && IS_ENABLED(CONFIG_IPC_MAJOR_4)) {
144144
err = pipeline_reset(host->pipeline, host);
145145
if (err < 0)
146146
reply->error = err;

src/audio/pipeline/pipeline-stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int pipeline_comp_list(struct comp_dev *current,
229229
* component and we aren't using IPC4. With IPC4 each pipeline receives
230230
* commands separately so we don't need to trigger them together
231231
*/
232-
if (!is_single_ppl && (!is_same_sched || IPC4_MOD_ID(current->ipc_config.id))) {
232+
if (!is_single_ppl && (!is_same_sched || IS_ENABLED(CONFIG_IPC_MAJOR_4))) {
233233
pipe_dbg(current->pipeline,
234234
"current is from another pipeline");
235235
return 0;

0 commit comments

Comments
 (0)