From 62945ad24490d399fcfdf1dff8633dd136f9a136 Mon Sep 17 00:00:00 2001 From: DineshKumar Kalva Date: Mon, 21 Sep 2026 13:24:31 +0530 Subject: [PATCH] probe: add probe support for AMD ACP7x platform Add the probe (data extraction) feature to the AMD ACP7x platform, so audio data can be tapped from pipeline buffers at runtime and streamed to the host over the compress device. Enable CONFIG_PROBE and the ACP host DMA probe path in the ACP7x board configuration, and keep the extractor DMA channel in acp_dma_dev_data::probe_ctx via struct acp_host_probe_data. The context is allocated when the extractor DMA is initialised and released when it is torn down, so the channel stays private to probe and does not reuse the DAI dai_index_ptr field. On ACP7x IPC3, look up probe points with ipc_get_buffer_by_id(). Probe point IDs name buffers, so the component-only lookup rejects valid IDs on this platform. Other IPC3 platforms keep ipc_get_comp_by_id(). Signed-off-by: DineshKumar Kalva --- app/boards/acp_7_x_adsp.conf | 6 ++-- .../acp_7_x/include/platform/platform_misc.h | 6 ++++ src/probe/probe.c | 36 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/app/boards/acp_7_x_adsp.conf b/app/boards/acp_7_x_adsp.conf index 310d9ac52b9f..44847f4c77de 100644 --- a/app/boards/acp_7_x_adsp.conf +++ b/app/boards/acp_7_x_adsp.conf @@ -5,8 +5,6 @@ CONFIG_DCACHE_LINE_SIZE=128 CONFIG_DYNAMIC_INTERRUPTS=y CONFIG_SHARED_INTERRUPTS=n CONFIG_ZEPHYR_LOG=y -CONFIG_LOG_MODE_DEFERRED=n -CONFIG_LOG_MODE_MINIMAL=y CONFIG_DMA=y CONFIG_DMA_DOMAIN=n CONFIG_ZEPHYR_NATIVE_DRIVERS=y @@ -66,3 +64,7 @@ CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_LOG_MAX_LEVEL=3 CONFIG_SOF_LOG_LEVEL_INF=y CONFIG_SYS_HEAP_BIG_ONLY=y +CONFIG_PROBE=y +CONFIG_PROBE_DMA_MAX=2 +CONFIG_PROBE_POINTS_MAX=16 +CONFIG_AMD_ACP_HOST_DMA_PROBE=y diff --git a/src/platform/amd/acp_7_x/include/platform/platform_misc.h b/src/platform/amd/acp_7_x/include/platform/platform_misc.h index 69c03fce9dcb..6ed91d6068de 100644 --- a/src/platform/amd/acp_7_x/include/platform/platform_misc.h +++ b/src/platform/amd/acp_7_x/include/platform/platform_misc.h @@ -626,6 +626,11 @@ struct dmic_context { uint32_t index; }; +/** Host DMA probe extractor context, stored in acp_dma_dev_data::probe_ctx. */ +struct acp_host_probe_data { + uint32_t channel; +}; + struct acp_dma_dev_data { struct dma_context dma_ctx; struct acp_dma_chan_data chan_data[ACP_DMA_CHAN_COUNT]; @@ -633,5 +638,6 @@ struct acp_dma_dev_data { ATOMIC_DEFINE(atomic, ACP_DMA_CHAN_COUNT); struct dma_config *dma_config; void *dai_index_ptr; + void *probe_ctx; }; diff --git a/src/probe/probe.c b/src/probe/probe.c index 22dafba75ac7..e4a6b02c84ec 100644 --- a/src/probe/probe.c +++ b/src/probe/probe.c @@ -205,6 +205,26 @@ static int probe_dma_init(struct probe_dma_ext *dma, uint32_t direction) return -ENODEV; } +#if CONFIG_AMD_ACP_HOST_DMA_PROBE + { + struct acp_dma_dev_data *dev_data = dma->dc.dmac->z_dev->data; + struct acp_host_probe_data *probe_data; + + /* Match kernel acp_dsp_stream indexing: phy_off[stream_tag - 1]. */ + channel = dma->stream_tag - 1; + if (!dev_data->probe_ctx) { + probe_data = rzalloc(SOF_MEM_FLAG_USER | SOF_MEM_FLAG_COHERENT, + sizeof(*probe_data)); + if (!probe_data) + return -ENOMEM; + dev_data->probe_ctx = probe_data; + } else { + probe_data = dev_data->probe_ctx; + } + probe_data->channel = channel; + } +#endif + /* get required address alignment for dma buffer */ err = dma_get_attribute(dma->dc.dmac->z_dev, DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT, &addr_align); @@ -266,6 +286,16 @@ static int probe_dma_deinit(struct probe_dma_ext *dma) return err; } #if CONFIG_ZEPHYR_NATIVE_DRIVERS +#if CONFIG_AMD_ACP_HOST_DMA_PROBE + { + struct acp_dma_dev_data *dev_data = dma->dc.dmac->z_dev->data; + + if (dev_data->probe_ctx) { + rfree(dev_data->probe_ctx); + dev_data->probe_ctx = NULL; + } + } +#endif dma_release_channel(dma->dc.dmac->z_dev, dma->dc.chan->index); sof_dma_put(dma->dc.dmac); #else @@ -1192,6 +1222,8 @@ int probe_point_add(uint32_t count, const struct probe_point *probe) dev = ipc_get_comp_by_id(ipc_get(), IPC4_COMP_ID(buf_id->fields.module_id, buf_id->fields.instance_id)); +#elif CONFIG_AMD + dev = ipc_get_buffer_by_id(ipc_get(), buf_id->full_id); #else dev = ipc_get_comp_by_id(ipc_get(), buf_id->full_id); #endif @@ -1446,8 +1478,12 @@ int probe_point_remove(uint32_t count, const uint32_t *buffer_id) buf->probe_cb_arg = NULL; } } +#else +#if CONFIG_AMD + dev = ipc_get_buffer_by_id(ipc_get(), buffer_id[i]); #else dev = ipc_get_comp_by_id(ipc_get(), buffer_id[i]); +#endif if (dev) { struct comp_buffer *probe_buf = (struct comp_buffer *)dev->cb;