Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
7225643
audio: buffers/ipc4: add DP-to-DP component binding
singalsu Nov 22, 2026
d24b603
ipc4: helper: guard NULL module_data in ipc4_comp_connect()
lrgirdwo Nov 22, 2026
0a3c326
schedule: zephyr_dp_schedule: use a mutex for the per-core DP lock
ujfalusi Nov 22, 2026
7f4868e
audio: module_adapter: pass SIZE_MAX to audio_buffer_sync_secondary_b…
singalsu Nov 22, 2026
b4b9244
audio: module_adapter: set DP sink params left unset by legacy consumers
ujfalusi Nov 22, 2026
f92a5bf
audio: module_adapter: skip virtual detect sinks in DP period calcula…
singalsu Nov 22, 2026
d6a8436
zephyr: edf_schedule: cancel delayed work in schedule_edf_task_free()
lrgirdwo Nov 22, 2026
792377d
audio: pipeline: log comp_prepare failure and export pipeline_schedul…
lrgirdwo Nov 22, 2026
73af4bb
ipc4: handler: support hostless pipelines and COMP_STATE_PREPARE
lrgirdwo Nov 22, 2026
5b03191
lib, audio: add NULL guards during DAI, DMA, and copier teardown
lrgirdwo Nov 22, 2026
0f964d3
ipc: ipc-helper: reset component before freeing if not in ready state
lrgirdwo Nov 22, 2026
9b0f3a6
lib: notifier: wait for completion of remote core notifications
singalsu Nov 22, 2026
44d7281
lib: agent: guard against NULL system agent in sa_set_panic_on_delay()
singalsu Nov 22, 2026
6713c7e
audio: host-zephyr: increase minimum no-bytes warning interval
singalsu Nov 22, 2026
1b955da
audio: intel_uaol: only advertise UAOL links that answered
ujfalusi Nov 22, 2026
bee3056
sof_ri_info: add PTL Intel debug signing key
lrgirdwo Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions src/audio/buffers/audio_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@
int audio_buffer_attach_secondary_buffer(struct sof_audio_buffer *buffer, bool at_input,
struct sof_audio_buffer *secondary_buffer)
{
#ifdef CONFIG_DP_TO_DP_BIND
/* check per-side: allow attaching on both sides (needed for DP-to-DP) */
if (at_input && buffer->secondary_buffer_sink)
return -EINVAL;
if (!at_input && buffer->secondary_buffer_source)
return -EINVAL;
#else
if (buffer->secondary_buffer_sink || buffer->secondary_buffer_source)
return -EINVAL;
#endif

/* secondary buffer must share audio params with the primary buffer */
secondary_buffer->audio_stream_params = buffer->audio_stream_params;
Expand All @@ -48,6 +56,19 @@ int audio_buffer_sync_secondary_buffer(struct sof_audio_buffer *buffer, size_t l
struct sof_source *data_src;
struct sof_sink *data_dst;

#ifdef CONFIG_DP_TO_DP_BIND
if (buffer->secondary_buffer_sink &&
buffer->secondary_buffer_sink == buffer->secondary_buffer_source) {
/*
* DP-to-DP case: a single shared ring_buffer is attached on both sides.
* The source DP writes directly to the ring_buffer sink API, and the
* sink DP reads directly from the ring_buffer source API.
* No copying is needed during the LL cycle.
*/
return 0;
}
#endif

if (buffer->secondary_buffer_sink) {
/*
* audio_buffer sink API is shadowed, that means there's a secondary_buffer
Expand Down Expand Up @@ -95,7 +116,12 @@ void audio_buffer_free(struct sof_audio_buffer *buffer)
CORE_CHECK_STRUCT(buffer);
#if CONFIG_PIPELINE_2_0
audio_buffer_free(buffer->secondary_buffer_sink);
#ifdef CONFIG_DP_TO_DP_BIND
if (buffer->secondary_buffer_source != buffer->secondary_buffer_sink)
audio_buffer_free(buffer->secondary_buffer_source);
#else
audio_buffer_free(buffer->secondary_buffer_source);
#endif
#endif /* CONFIG_PIPELINE_2_0 */
/* "virtual destructor": free the buffer internals and buffer memory */
buffer->ops->free(buffer);
Expand Down Expand Up @@ -203,18 +229,14 @@ uint32_t audio_buffer_sink_get_lft(struct sof_sink *sink)
return us_in_buffer;

/*
* TODO, Currently there's no DP to DP connection
* >>> the code below is never accessible and won't work because of cache incoherence <<<
*
* to make DP to DP connection possible:
* NOTE: DP-to-DP connections are now supported via a single shared ring_buffer
* attached as secondary buffer on both sides of a comp_buffer.
*
* 1) module data must be ALWAYS located in non cached memory alias, allowing
* cross core access to params like period (needed below) and calling
* module_get_deadline for the next module, regardless of cores the modules are
* running on
* 2) comp_buffer must be removed from all pipeline code, replaced with a generic abstract
* class audio_buffer - allowing using comp_buffer and ring_buffer without current
* "hybrid buffer" solution
* Future improvements:
* 1) module data should be in non-cached memory alias for reliable
* cross-core access to params like period and deadlines
* 2) comp_buffer should be replaced with generic audio_buffer
* throughout pipeline code (Pipeline 2.0)
*/
}

Expand Down
11 changes: 10 additions & 1 deletion src/audio/buffers/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ static inline void ring_buffer_writeback_shared(struct ring_buffer *ring_buffer,
dcache_writeback_region(ptr, size);
}


/**
* @brief remove the queue from the list, free memory
*/
Expand All @@ -105,6 +104,16 @@ __cold static void ring_buffer_free(struct sof_audio_buffer *audio_buffer)

sof_ctx_free(alloc, (__sparse_force void *)ring_buffer->_data_buffer);
sof_ctx_free(alloc, ring_buffer);

#ifdef CONFIG_DP_TO_DP_BIND
/*
* When CONFIG_DP_TO_DP_BIND is enabled, ipc4_comp_connect() takes an extra vregion
* reference for each ring_buffer created from a module vregion. The alloc ctx of a DP
* module lives inside its vregion and is freed by the last vregion_put().
*/
if (alloc && alloc->vreg)
vregion_put(alloc->vreg);
#endif
}

static void ring_buffer_reset(struct sof_audio_buffer *audio_buffer)
Expand Down
16 changes: 12 additions & 4 deletions src/audio/copier/copier_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,21 @@ __cold void copier_dai_free(struct processing_module *mod)
assert_can_be_cold();

for (int i = 0; i < cd->endpoint_num; i++) {
dai_common_free(cd->dd[i]);
mod_free(mod, cd->dd[i]->gain_data);
mod_free(mod, cd->dd[i]);
if (cd->dd[i]) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this should be split into 5 patches, one for each subject above with correct author from the wov-001 tag.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed: split into 5 atomic commits matching wov-001 subjects and authors:

  • 5b03191fa (Liam Girdwood) lib, audio: add NULL guards during DAI, DMA, and copier teardown
  • 0f964d360 (Liam Girdwood) ipc: ipc-helper: reset component before freeing if not in ready state
  • 9b0f3a6a5 (Seppo Ingalsuo) lib: notifier: wait for completion of remote core notifications
  • 44d7281ad (Seppo Ingalsuo) lib: agent: guard against NULL system agent in sa_set_panic_on_delay()
  • 6713c7ec9 (Seppo Ingalsuo) audio: host-zephyr: increase minimum no-bytes warning interval

if (cd->dd[i]->gain_data) {
mod_free(mod, cd->dd[i]->gain_data);
cd->dd[i]->gain_data = NULL;
}
dai_common_free(cd->dd[i]);
mod_free(mod, cd->dd[i]);
cd->dd[i] = NULL;
}
}
/* only dai have multi endpoint case */
if (cd->multi_endpoint_buffer)
if (cd->multi_endpoint_buffer) {
buffer_free(cd->multi_endpoint_buffer);
cd->multi_endpoint_buffer = NULL;
}
}

int copier_dai_prepare(struct comp_dev *dev, struct copier_data *cd)
Expand Down
27 changes: 23 additions & 4 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,22 +794,36 @@ __cold void dai_common_free(struct dai_data *dd)
{
assert_can_be_cold();

if (!dd)
return;

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
io_perf_monitor_release_slot(dd->io_perf_dai_byte_count);
#endif
telemetry_unregister_dai(dd);

if (dd->group)
if (dd->group) {
dai_group_put(dd->group);
dd->group = NULL;
}

dai_dma_release_channel(dd);
sof_dma_put(dd->dma);
if (dd->dma) {
sof_dma_put(dd->dma);
dd->dma = NULL;
}

dai_release_llp_slot(dd);

dai_put(dd->dai);
if (dd->dai) {
dai_put(dd->dai);
dd->dai = NULL;
}

sof_heap_free(dd->alloc_ctx.heap, dd->dai_spec_config);
if (dd->dai_spec_config) {
sof_heap_free(dd->alloc_ctx.heap, dd->dai_spec_config);
dd->dai_spec_config = NULL;
}

#if CONFIG_UAOL_INTEL_ADSP
uaol_free(dd);
Expand All @@ -822,6 +836,11 @@ __cold static void dai_free(struct comp_dev *dev)

assert_can_be_cold();

if (!dd) {
comp_free_device(dev);
return;
}

if (dd->group)
notifier_unregister(dev, dd->group, NOTIFIER_ID_DAI_TRIGGER);

Expand Down
2 changes: 1 addition & 1 deletion src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ static int host_get_status(struct comp_dev *dev, struct host_data *hd, struct dm
}

/* Minimum time between 2 consecutive "no bytes to copy" messages in milliseconds */
#define SOF_MIN_NO_BYTES_INTERVAL_MS 20
#define SOF_MIN_NO_BYTES_INTERVAL_MS 1000

static inline bool host_handle_eos(struct host_data *hd, struct comp_dev *dev,
uint32_t avail_samples)
Expand Down
21 changes: 18 additions & 3 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,21 @@ static void module_adapter_calculate_dp_period(struct comp_dev *dev)
unsigned int period = UINT32_MAX;

for (int i = 0; i < mod->num_of_sinks; i++) {
unsigned int frame_bytes = sink_get_frame_bytes(mod->sinks[i]);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can we say in teh commit message why this is needed for WOV and state flow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed: split into the 3 commits from wov-001 (ae85ce2a7, 15d4ff177, 4541bd306) and expanded the commit messages in b4b9244c6 (Peter Ujfalusi) and f92a5bfc2 (Seppo Ingalsuo) to explain why propagating mod->stream_params to legacy consumers and skipping zero-rate/frame-size virtual detect sinks are required during the WoV INIT -> PREPARE -> ACTIVE state flow.

unsigned int rate = sink_get_rate(mod->sinks[i]);

/* Skip virtual/event-only detect sinks with no audio format so WoV
* pipelines prepare without dividing by zero (period comes from
* source or dev->period during INIT -> PREPARE).
*/
if (!frame_bytes || !rate)
continue;

/* calculate time required the module to provide OBS data portion - a period
* use 64bit integers to avoid overflows
*/
unsigned int sink_period = 1000000ULL * sink_get_min_free_space(mod->sinks[i]) /
(sink_get_frame_bytes(mod->sinks[i]) *
sink_get_rate(mod->sinks[i]));
(frame_bytes * rate);
/* note the minimal period for the module */
if (period > sink_period)
period = sink_period;
Expand Down Expand Up @@ -493,6 +502,12 @@ int module_adapter_prepare(struct comp_dev *dev)
* Second example is a module with variable data rate on output (like MPEG encoder)
*/
if (mod->dev->ipc_config.proc_domain == COMP_PROCESSING_DOMAIN_DP) {
/* legacy comp_driver consumers don't set their input buffer params at bind */
comp_dev_for_each_consumer(dev, sink) {
if (!audio_stream_get_rate(&sink->stream) && mod->stream_params)
buffer_set_params(sink, mod->stream_params, BUFFER_UPDATE_FORCE);
}

/* calculate DP period if a module didn't */
if (!dev->period)
module_adapter_calculate_dp_period(dev);
Expand Down Expand Up @@ -604,7 +619,7 @@ static int module_adapter_copy_ring_buffers(struct comp_dev *dev)
/* input - we need to copy data from audio_stream (as source)
* to ring_buffer (as sink)
*/
err = audio_buffer_sync_secondary_buffer(&buffer->audio_buffer, UINT_MAX);
err = audio_buffer_sync_secondary_buffer(&buffer->audio_buffer, SIZE_MAX);

if (err) {
comp_err(dev, "LL to DP copy error status: %d", err);
Expand Down
7 changes: 6 additions & 1 deletion src/audio/pipeline/pipeline-params.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,13 @@ static int pipeline_comp_prepare(struct comp_dev *current,
return err;

err = comp_prepare(current);
if (err < 0 || err == PPL_STATUS_PATH_STOP)
if (err < 0 || err == PPL_STATUS_PATH_STOP) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This patch looks like we can again split and attribute correct author from wov-001 tag.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed: split into 3 commits from wov-001 (3ef8df0a4, d4de9e8af, 063afaf4e):

  • d6a84361d (Liam Girdwood) zephyr: edf_schedule: cancel delayed work in schedule_edf_task_free()
  • 792377dd1 (Liam Girdwood) audio: pipeline: log comp_prepare failure and export pipeline_schedule_cancel()
  • 73af4bb44 (Liam Girdwood) ipc4: handler: support hostless pipelines and COMP_STATE_PREPARE

if (err < 0) {
pipe_err(current->pipeline, "comp_prepare for comp 0x%x failed %d",
dev_comp_id(current), err);
}
return err;
}

return pipeline_for_each_comp(current, ctx, dir);
}
Expand Down
7 changes: 4 additions & 3 deletions src/audio/pipeline/pipeline-schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ SOF_DEFINE_REG_UUID(dp_task);

#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */

static void pipeline_schedule_cancel(struct pipeline *p)
void pipeline_schedule_cancel(struct pipeline *p)
{
schedule_task_cancel(p->pipe_task);
if (p->pipe_task)
schedule_task_cancel(p->pipe_task);

/* enable system agent panic, when there are no longer
* DMA driven pipelines
Expand Down Expand Up @@ -655,7 +656,7 @@ void pipeline_schedule_copy(struct pipeline *p, uint64_t start)
* when we attempt to start B, we don't need to schedule pipeline C -
* it's already running.
*/
if (task_is_active(p->pipe_task))
if (!p->pipe_task || task_is_active(p->pipe_task))
return;

if (p->sched_next && task_is_active(p->sched_next->pipe_task))
Expand Down
7 changes: 7 additions & 0 deletions src/include/sof/audio/audio_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,16 @@ void audio_buffer_reset(struct sof_audio_buffer *buffer)
if (buffer->secondary_buffer_sink && buffer->secondary_buffer_sink->ops->reset)
buffer->secondary_buffer_sink->ops->reset(buffer->secondary_buffer_sink);

#ifdef CONFIG_DP_TO_DP_BIND
if (buffer->secondary_buffer_source &&
buffer->secondary_buffer_source != buffer->secondary_buffer_sink &&
buffer->secondary_buffer_source->ops->reset)
buffer->secondary_buffer_source->ops->reset(buffer->secondary_buffer_source);
#else
if (buffer->secondary_buffer_source && buffer->secondary_buffer_source->ops->reset)
buffer->secondary_buffer_source->ops->reset(buffer->secondary_buffer_source);
#endif
#endif
}

/* Audio-buffer wrappers for the source-sink API */
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/audio/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ int pipeline_comp_dp_task_init(struct comp_dev *comp);
* \param[in] start Pipeline start time in microseconds.
*/
void pipeline_schedule_copy(struct pipeline *p, uint64_t start);
void pipeline_schedule_cancel(struct pipeline *p);

/**
* \brief Triggers pipeline's scheduling component.
Expand Down
3 changes: 3 additions & 0 deletions src/include/sof/lib/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ static inline void sa_set_panic_on_delay(bool enabled)
{
struct sa *sa = sof_get()->sa;

if (!sa)
return;

if (enabled)
atomic_add(&sa->panic_cnt, 1);
else
Expand Down
2 changes: 1 addition & 1 deletion src/include/sof/schedule/zephyr_dp_schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct scheduler_dp_task_memory {

#endif /* CONFIG_SOF_USERSPACE_APPLICATION */
/** @brief Per-core DP scheduler locks, see scheduler_dp_lock(). */
extern struct k_sem dp_lock[CONFIG_MP_MAX_NUM_CPUS];
extern struct k_mutex dp_lock[CONFIG_MP_MAX_NUM_CPUS];

/**
* @brief DP scheduler ops, see struct scheduler_ops.
Expand Down
9 changes: 8 additions & 1 deletion src/ipc/ipc-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,14 @@ __cold int ipc_comp_free(struct ipc *ipc, uint32_t comp_id)
if (!cpu_is_me(icd->core))
return ipc_process_on_core(icd->core, false);

/* check state */
/* check state: if not ready, stop and reset to release resources before freeing */
if (icd->cd->state != COMP_STATE_READY) {
if (icd->cd->state == COMP_STATE_ACTIVE)
comp_trigger(icd->cd, COMP_TRIGGER_STOP);
comp_reset(icd->cd);
comp_set_state(icd->cd, COMP_TRIGGER_RESET);
}

if (icd->cd->state != COMP_STATE_READY) {
tr_err(&ipc_tr, "comp id: 0x%x state is %d cannot be freed",
comp_id, icd->cd->state);
Expand Down
Loading
Loading