Skip to content

Commit 19e2b30

Browse files
committed
audio: pipeline: IPC3 xrun IPC messages should not be sent in IPC4 builds
The IPC interface to notify host of over/underruns is different between IPC3 and IPC4. The pipeline_xrun() implementation however was called in common code and could lead to corruption of the host-DSP mailboxes. In practise errors were not hit in current SOF builds as none of the DMA drivers that are used with targets using IPC4, return runtime errors in their dma_reload() implementations, so dai_report_xrun() was never called. Zephyr DMA does allow errors to be returned for reload, so correct the implementation to never send IPC3 notifications in IPC4 builds. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent b1a7c44 commit 19e2b30

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/audio/pipeline/pipeline-xrun.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ LOG_MODULE_DECLARE(pipe, CONFIG_SOF_LOG_LEVEL);
2929
*/
3030
#define NO_XRUN_RECOVERY 1
3131

32+
#if CONFIG_IPC_MAJOR_3
33+
3234
/* This function always returns success */
3335
static int pipeline_comp_xrun(struct comp_dev *current,
3436
struct comp_buffer *calling_buf,
@@ -49,6 +51,8 @@ static int pipeline_comp_xrun(struct comp_dev *current,
4951
return pipeline_for_each_comp(current, ctx, dir);
5052
}
5153

54+
#endif /* CONFIG_IPC_MAJOR_3 */
55+
5256
#if NO_XRUN_RECOVERY
5357
/* recover the pipeline from a XRUN condition */
5458
int pipeline_xrun_recover(struct pipeline *p)
@@ -139,13 +143,15 @@ int pipeline_xrun_handle_trigger(struct pipeline *p, int cmd)
139143
void pipeline_xrun(struct pipeline *p, struct comp_dev *dev,
140144
int32_t bytes)
141145
{
146+
#if CONFIG_IPC_MAJOR_3
142147
struct pipeline_data data;
143148
struct pipeline_walk_context walk_ctx = {
144149
.comp_func = pipeline_comp_xrun,
145150
.comp_data = &data,
146151
.skip_incomplete = true,
147152
};
148153
struct sof_ipc_stream_posn posn;
154+
#endif
149155
int ret;
150156

151157
/* don't flood host */
@@ -162,6 +168,12 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev,
162168
pipe_err(p, "Pipelines notification about XRUN failed, ret = %d",
163169
ret);
164170

171+
/*
172+
* The IPC position info reporting via window2 is only
173+
* used for IPC3 and e.g. in IPC4 this is conflicting
174+
* with the debug window usages (logging, debug, ..)
175+
*/
176+
#if CONFIG_IPC_MAJOR_3
165177
memset(&posn, 0, sizeof(posn));
166178
ipc_build_stream_posn(&posn, SOF_IPC_STREAM_TRIG_XRUN,
167179
dev_comp_id(dev));
@@ -172,4 +184,5 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev,
172184
data.p = p;
173185

174186
walk_ctx.comp_func(dev, NULL, &walk_ctx, dev->direction);
187+
#endif
175188
}

0 commit comments

Comments
 (0)