Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions app/boards/acp_7_x_adsp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 6 additions & 0 deletions src/platform/amd/acp_7_x/include/platform/platform_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,18 @@ 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];

ATOMIC_DEFINE(atomic, ACP_DMA_CHAN_COUNT);
struct dma_config *dma_config;
void *dai_index_ptr;
void *probe_ctx;
};

36 changes: 36 additions & 0 deletions src/probe/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If this is for IPC3 only then maybe it better to just say if ipc3 here ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We don't have idea who else would be using the IPC3 and the change would impact the probe feature, so used the AMD config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think its safe to say IPC3 here, this means other IPC3 user wont have to add to the conditional logic.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Other IPC3 users may not be using the ipc_get_buffer_by_id API. So, if someone enables IPC3 but want to use the ipc_get_comp_by_id, then there will be impact. Let us know your view

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, if this is concern it probably better to have a Kconfig that uses this method for probes in the kconfig menu. This way it can be selected when needed. i.e. AMD conf files would select it.

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
Expand Down Expand Up @@ -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;
Expand Down
Loading