Skip to content

audio: host-zephyr: add HOST_DMA_IPC_POSITION_UPDATES Kconfig#10849

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202606-make-ipc-pos-updates-conditional
Open

audio: host-zephyr: add HOST_DMA_IPC_POSITION_UPDATES Kconfig#10849
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202606-make-ipc-pos-updates-conditional

Conversation

@kv2019i
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i commented Jun 5, 2026

Add a built option HOST_DMA_IPC_POSITION_UPDATES to control whether functionality to send IPC stream position updates is enabled or not. Most platforms provide more efficient means for host to monitor DMA state, so this code is in most cases unncessary.

The current IPC sending code (from audio context) also assume kernel context, so making this functionality user-space compatible will require extra work.

Enable DMA IPC position updates by default for IPC3 as the feature can be controlled by host with sof_ipc_stream_params.no_stream_position IPC interface. Disable the feature by default for IPC4, as there is no host IPC interface to control this and copier_update_params() unconditionally disables IPC updates for IPC4 now, so this code is never used.

Copilot AI review requested due to automatic review settings June 5, 2026 12:25
@kv2019i kv2019i requested a review from jsarha June 5, 2026 12:25
@kv2019i kv2019i requested review from lyakh and tmleman June 5, 2026 12:25
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Jun 5, 2026

For context, part of #10558

Copy link
Copy Markdown
Contributor

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

Adds a Kconfig option to control whether host DMA stream position updates are reported via IPC messages, and uses it to compile-time disable the IPC notification path in the Zephyr host implementation.

Changes:

  • Introduce HOST_DMA_IPC_POSITION_UPDATES Kconfig (default enabled for IPC3).
  • Guard IPC position-update sending (and ipc_msg allocation/free) in host-zephyr.c behind the new Kconfig.
  • Make struct host_data::msg conditional on CONFIG_HOST_DMA_IPC_POSITION_UPDATES.

Reviewed changes

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

File Description
src/audio/Kconfig Adds the new Kconfig switch controlling IPC-based position updates.
src/audio/host-zephyr.c Wraps IPC position update logic and message lifecycle with the new config option.
src/audio/copier/host_copier.h Makes the ipc_msg *msg member conditional on the new config.

Comment thread src/audio/copier/host_copier.h
Comment thread src/audio/Kconfig Outdated
@kv2019i kv2019i force-pushed the 202606-make-ipc-pos-updates-conditional branch from be41a4b to 143d6c2 Compare June 5, 2026 14:40
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Jun 5, 2026

V2 pushed:

  • make it possible to build IPC3 with position update feature disable
  • change the Kconfig logic to prevent use of position updates with IPC4 (as it doesn't fully work)
  • move "report_pos" under ifdef as this field is only needed for IPC position reporting

Comment thread src/audio/host-zephyr.c Outdated
dma_sg_init(&hd->local.elem_array);

ipc_build_stream_posn(&hd->posn, SOF_IPC_STREAM_POSITION, config_id);
hd->chan_index = -EINVAL;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

moving this seems unrelated, any special reason for this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, looks like the place after next #endif whould be equivalent to this. I see no reason for moving it either.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@lyakh @jsarha it was inside the ifdef in earlier version of the patch, so moved out. But ack, can be moved below

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in V3

Copy link
Copy Markdown
Contributor

@jsarha jsarha left a comment

Choose a reason for hiding this comment

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

The moving the chan_index initialization looks unnecessary, but also harmless.

Comment thread src/audio/host-zephyr.c Outdated
dma_sg_init(&hd->local.elem_array);

ipc_build_stream_posn(&hd->posn, SOF_IPC_STREAM_POSITION, config_id);
hd->chan_index = -EINVAL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, looks like the place after next #endif whould be equivalent to this. I see no reason for moving it either.

Add a built option HOST_DMA_IPC_POSITION_UPDATES to control whether
functionality to send IPC stream position updates is enabled or
not. Most platforms provide more efficient means for host to
monitor DMA state, so this code is in most cases unncessary.

The current IPC sending code (from audio context) also assume
kernel context, so making this functionality user-space compatible
will require extra work.

Enable DMA IPC position updates by default for IPC3 as the feature can
be controlled by host with sof_ipc_stream_params.no_stream_position IPC
interface. Disable the feature by default for IPC4, as there is no host
IPC interface to control this and copier_update_params() unconditionally
disables IPC updates for IPC4 now, so this code is never used.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202606-make-ipc-pos-updates-conditional branch from 143d6c2 to 7730ace Compare June 8, 2026 09:33
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Jun 8, 2026

V3 pushed:

  • fixed the unnecessary chan_index init move

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.

4 participants