Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Jan 12, 2026

Fix potential issue with IPC3 xrun messages written on top of IPC4 debug window2 content.

Issue not hit with current SOF builds, but make sure this won't be hit in future either.

…ilds

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>
To prevent any accidental use in new code, add an assert to
mailbox_stream_write() against use in IPC4 builds. The "stream mailbox"
is not available in IPC4 mailbox layout, so it must not be used.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents potential conflicts between IPC3 xrun message handling and IPC4 debug window2 functionality by conditionally compiling IPC3-specific code paths. The changes ensure that stream mailbox writes and xrun position reporting are only active when using IPC3, avoiding unintended overwrites of IPC4 debug window content.

Changes:

  • Added compile-time guards to prevent stream mailbox usage in IPC4 configurations
  • Wrapped IPC3-specific xrun handling code with conditional compilation directives
  • Added clarifying comments explaining the IPC version-specific behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/include/sof/lib/mailbox.h Adds IPC4 stub for mailbox_stream_write that asserts false, preventing accidental use
src/audio/pipeline/pipeline-xrun.c Wraps IPC3-specific xrun position reporting and pipeline walking code with CONFIG_IPC_MAJOR_3 guards

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants