Skip to content

probe: IPC3 firmware probe fixes and direct host-ring extraction for i.MX8MP - #11399

Open
ursus161 wants to merge 3 commits into
thesofproject:mainfrom
ursus161:probes-imx8mp
Open

ursus161 wants to merge 3 commits into
thesofproject:mainfrom
ursus161:probes-imx8mp

Conversation

@ursus161

@ursus161 ursus161 commented Nov 4, 2026

Copy link
Copy Markdown

Fixes IPC3 probes on i.MX8MP (Zephyr) and lets probe data reach the host.

  • Look up probe point buffers with COMP_TYPE_ANY. They were never found, so
    every PROBE_POINT_ADD failed with -EINVAL.
  • Zero-initialize the DMA config structs in probe_dma_init().
  • The i.MX host DMA cannot write to Linux RAM. For IPC3 the host now passes
    a coherent buffer address in the PROBE_INIT stream_tag, and the firmware
    memcpy()s packets into it and publishes a byte counter.

Kernel side: thesofproject/linux#6013

Tested on imx8mp-evk with the kernel PR (1 kHz tone extracted fine).

Stefan Ghetu added 2 commits November 4, 2026 09:37
ipc_get_comp_by_id() only searches COMP_TYPE_COMPONENT devices.
Buffers are COMP_TYPE_BUFFER so they were never found on IPC3,
making every PROBE_POINT_ADD return -EINVAL.  The subsequent
dev->type != COMP_TYPE_BUFFER check was therefore unreachable.
Use COMP_TYPE_ANY in probe_point_add() and probe_point_remove()
to find buffers while keeping the existing type check intact.

Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
The Zephyr-native probe_dma_init() left dma_config and
dma_block_config uninitialized.  Struct fields not explicitly
assigned (e.g. dest_address for LMEM_TO_HMEM) contain stack
garbage, which causes the Zephyr DMA driver to reject the config
call.  Add {0} initializers so unused fields default to zero.

Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
@sofci

sofci commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

Copilot AI left a comment

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.

🟡 Changes recommended

The direct-ring path can misinterpret DMA stream IDs as host addresses and overrun small host rings, creating critical memory-corruption risks.

3 open issues
What changed in this PR

This PR repairs IPC3 probe setup and adds direct host-ring extraction for i.MX8MP, paired with the linked Linux probe client.

Changes:

  • Fix probe-buffer lookup and zero-initialize DMA configuration structures.
  • Add direct copies into a host-provided ring with a published byte counter.
  • Enable probes with up to 16 probe points on the i.MX8MP EVK.
File Description
src/​probe/​probe.c Fixes probe setup and adds IPC3 host-ring extraction.
app/​boards/​imx8mp_evk_mimx8ml8_adsp.conf Enables probes and configures the probe-point limit.

Review effort: Balanced

Comment thread src/probe/probe.c Resolved
Comment thread src/probe/probe.c Outdated
Comment on lines +402 to +404
#if CONFIG_IPC_MAJOR_3 && CONFIG_ZEPHYR_NATIVE_DRIVERS
err = probe_host_write(&_probe->ext_dma,
(void *)_probe->ext_dma.dmapb.r_ptr, avail);
Comment thread src/probe/probe.c Resolved
@lgirdwood

Copy link
Copy Markdown
Member

@ursus161 @bhiregoudar @DINESHKUMARK1 @LongWang100 @dbaluta looks like there is an issue with recent AMD update for IPC3 probes ? My platforms use IPC4 probes so I would recommend the IPC3 probes adopt a similar host interface for tooling reuse.
@ursus161 does reverting the recent ipc3 probes update fix the issue for you or are the other changes needed too ?

@dbaluta

dbaluta commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@lgirdwood, 2 questions as i have to see if we got this correct:

  • so we need to change the IPC3 interface for tooling from sof/tools/probes to match the interface for IPC4?
  • what is the recent AMD change that we need to revert (is this 78b23ad probe: add probe support for AMD ACP7x platform?).

@lgirdwood

Copy link
Copy Markdown
Member

@lgirdwood, 2 questions as i have to see if we got this correct:

  • so we need to change the IPC3 interface for tooling from sof/tools/probes to match the interface for IPC4?

The request is for IPC3 users to align on the host mechanisms for IPC3 config/control of probes, and the recommendation is to make it as close to IPC4 as possible for least effort in tool reuse.

  • what is the recent AMD change that we need to revert (is this 78b23ad probe: add probe support for AMD ACP7x platform?).

Yes. This PR changes part of that change.

@bhiregoudar

Copy link
Copy Markdown

@lgirdwood, 2 questions as i have to see if we got this correct:

  • so we need to change the IPC3 interface for tooling from sof/tools/probes to match the interface for IPC4?

The request is for IPC3 users to align on the host mechanisms for IPC3 config/control of probes, and the recommendation is to make it as close to IPC4 as possible for least effort in tool reuse.

  • what is the recent AMD change that we need to revert (is this 78b23ad probe: add probe support for AMD ACP7x platform?).

Yes. This PR changes part of that change.

We faced issues with finding the probe points with ipc_get_comp_by_id, so we used the ipc_get_buffer_by_id. Our changes are under macro, they won't affect other platforms.
I think IMX is also facing the same issue of not finding probe points with ipc_get_comp_by_id, could try with ipc_get_buffer_by_id to check whether it works or not.

The i.MX host DMA engine cannot transfer data to Linux RAM, so
dma_reload() never delivered probe data.  Instead, have the DSP
write extraction packets directly into a coherent buffer whose
bus address the kernel passes in the PROBE_INIT stream_tag field.

Add PROBE_HOST_HDR_SIZE, three IPC3-only fields in
probe_dma_ext (host_base/size/wr), probe_host_write() and wire
it into probe_task() for CONFIG_IPC_MAJOR_3+ZEPHYR_NATIVE_DRIVERS.
Use channel 0 in probe_dma_init() for IPC3 since stream_tag now
carries an address, not a channel index.

Also enable CONFIG_PROBE=y and CONFIG_PROBE_POINTS_MAX=16 for
the i.MX8MP EVK ADSP board.

Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
@ursus161

ursus161 commented Nov 4, 2026

Copy link
Copy Markdown
Author

We faced issues with finding the probe points with ipc_get_comp_by_id, so we used the ipc_get_buffer_by_id. Our changes are under macro, they won't affect other platforms. I think IMX is also facing the same issue of not finding probe points with ipc_get_comp_by_id, could try with ipc_get_buffer_by_id to check whether it works or not.

Yes, this is a way we could do it, at first hand I implemented it using ipc_get_comp_dev and it went OK. I am pushing hot fixes for this PR and the kernel one for problems left untreated raised by Copilot.

I have tested the workflow and all went good, we could use a similar model to existing IPC4 implementation for ease for the least effort, but do you see any problems with this implementation?

If yes, please give me a hard time

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.

6 participants