Skip to content

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

Open
ursus161 wants to merge 1 commit into
thesofproject:mainfrom
ursus161:probes-imx8mp
Open

ursus161 wants to merge 1 commit 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).

@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 Resolved
Comment thread src/kernel/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.

@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

@ursus161

ursus161 commented Nov 8, 2026

Copy link
Copy Markdown
Author

Hi all,
Could you please review this PR? The kernel side too, please point me in the right direction if something is not right, I'd like to progress on this feature.

Thanks,
Stefan
@dbaluta @lgirdwood @bhiregoudar @kv2019i @plbossart

Comment thread src/kernel/probe/probe.c Resolved
Comment thread src/kernel/probe/probe.c Resolved
@ursus161
ursus161 requested a review from dbaluta November 10, 2026 10:21
@lgirdwood

Copy link
Copy Markdown
Member

Hi all, Could you please review this PR? The kernel side too, please point me in the right direction if something is not right, I'd like to progress on this feature.

Thanks, Stefan @dbaluta @lgirdwood @bhiregoudar @kv2019i @plbossart

@ursus161 I'm not using IPC3 for probes, there are differences though with IPC4 probes so it really up to IPC3 user to align on IPC3 based protocol here. I would recommend ping other IPC3 users and keep going. If no other IPC3 users reply than we can probably merge next week.

@lgirdwood

Copy link
Copy Markdown
Member

test this please

Comment thread src/kernel/probe/probe.c Resolved
Comment thread src/kernel/probe/probe.c Resolved
@ursus161
ursus161 force-pushed the probes-imx8mp branch 2 times, most recently from accc45e to 094789f Compare November 17, 2026 09:28
Comment thread src/kernel/probe/probe.c Resolved
IPC3 PROBE_INIT carries no host buffer address: on Intel the kernel
programs the destination into the HDA stream, so the firmware never
needs one.  On i.MX the host DMA (nxp_sof_host_dma) is configured by
the firmware itself and was never given a destination, so the
extraction channel had nowhere to deliver to and dma_reload() never
moved any probe data.

Have the kernel pass the bus address of a coherent host buffer in the
PROBE_INIT stream_tag field.  The buffer is a header page followed by a
ring whose size is a power of two of at least the local probe ring.
Before every transfer point the host DMA block at the bytes about to go
out, at the offset given by the write counter, then let the common
dma_reload() path copy them, exactly as on the other Zephyr-native
platforms.  The transfer size is already clamped at the end of the
local ring and the host ring is a multiple of it, so the transfer never
has to wrap in the host ring either.

The host DMA reports no position, so after each transfer publish the
write counter in the first word of the header page for the kernel to
poll. Use channel 0 in probe_dma_init() under CONFIG_PROBE_IMX_HOST_DMA,
since stream_tag carries an address there, not a channel index; every other
IPC3 platform (e.g. AMD ACP, MediaTek) keeps its previous channel
selection unchanged.

Add the CONFIG_PROBE_IMX_HOST_DMA Kconfig option for this path and
enable it, together with CONFIG_PROBE=y and CONFIG_PROBE_POINTS_MAX=16,
for the i.MX8MP EVK ADSP board. Look up IPC3 probe points with
ipc_get_buffer_by_id() on this path, as on AMD.

Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
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