Uh oh!
There was an error while loading. Please reload this page.
Debug stream debugfs - #5154
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ujfalusi
left a comment
There was a problem hiding this comment.
@jsarha, what I would do is:
rename the ipc4-telemetry.c to ipc4-debugfs.c or something generic and use this to export the raw slots on the needed base.
You can have a single exported function as entry point, you can even move here the sof_ipc4_find_debug_slot_offset_by_type() function...
I know, mtrace is also uses debug slot, but it has been special cased out...
The ipc4-telemetry.h should remain as it is.
672baba to
68be79aComparejsarha
commented
Aug 30, 2024
@ujfalusi I took a shot at this. I still try make sure the zephyr tool can still read the execption file. |
jsarha
commented
Sep 25, 2024
lgirdwood
commented
Oct 22, 2024
jsarha
commented
Oct 23, 2024
lgirdwood
commented
Oct 23, 2024
ok, we can park now and see how well existing tools work - if slow or inconsistent we can continue here. |
lgirdwood
commented
Mar 19, 2025
I think this is useful in situations where no Python runtime is available. @ranj063@ujfalusi@bardliao lets move forward with this. |
68be79a to
2bd0077Comparejsarha
commented
Jun 25, 2025
Rephrased the first commit message a bit and resurrected ipc4-telemetry.h in the last commit (and updated the message accordingly), which is currently actually used. The code still works with debug_stream.py. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@lyakh is this Ok now? @bardliao , @lgirdwood only appled three last suggestions from Guennadi (Copyright 2024-2025), free in only one place sof_debug_slot_debugfs_entry_read(), and rename sof_ipc4_create_debug_slot_debugfs_node() to sof_ipc4_create_debug_slot_ro_debugfs_node() . Could you check those and reaprove if Ok. |
jsarha
commented
Aug 13, 2025
@lgirdwood should we still get this merged? @ujfalusi should I rebase, the PR getting old, again? |
bardliao
commented
Jul 27, 2026
@jsarha Is this PR still valid? |
jsarha
commented
Jul 27, 2026
Yes it is, or at least it was. But its not mandatory as debug_stream.py is able to use cavstool.py 's /dev/kmem code to get access to the debug window slot in question. |
bardliao
commented
Jul 27, 2026
@jsarha Can you resolve the conflicts? Then we can merge it. |
Adds sof_ipc4_create_debug_slot_ro_debugfs_node() -function for mapping a SOF Intel ipc4 debug window slot as debugfs file. The actual slot is specified with slot_type parameter. The alternatives are defined in include/sound/sof/ipc4/header.h and the slot is found with sof_ipc4_find_debug_slot_offset_by_type(). It also takes the data_offset parameter that specifies where the payload data in the slot begins. The portion that is mapped to the debugfs file is everything after the offset. The last parameter is the name of the file. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add new debug window slot type for debug-stream protocol. For details see src/debug/debug_stream/debug_stream_slot.h under SOF sources [1]. [1] https://github.com/thesofproject/sof Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Maps debug-stream debug window slot as read-only debugfs file with sof_ipc4_create_debug_slot_ro_debugfs_node() -function. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
… file Remove sof_ipc4_create_exception_debugfs_node() and ipc4-telemetry.c, and use sof_ipc4_create_debug_slot_ro_debugfs_node() instead for mapping "exception" debugfs file. In running system the SOF_IPC4_DEBUG_SLOT_TELEMETRY is used for telemetry data, but if configured, Zephyr exception data is dumped in the same debug window slot, right after the separator word. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
7d84e22 to
8969765Comparejsarha
commented
Jul 30, 2026
bardliao
commented
Jul 30, 2026
@lyakh Would you like to approve this PR again? So that we will take your Reviewed-by tag |
sof_ipc4_find_debug_slot_offset_by_type() prints a dev_dbg message every time a slot type is not found. When debugfs files are polled while the DSP is suspended, this fires on every access and spams the kernel log. Use dev_dbg_ratelimited() to suppress repeated messages. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the SOF IPC4 debug-window tooling by exposing the firmware “debug stream” slot (and reworking the existing exception/telemetry slot exposure) via dedicated read-only debugfs nodes.
Changes:
- Add a generic IPC4 debug-slot → debugfs mapping helper and use it to create
exceptionanddebug_streamdebugfs files at FW-ready time. - Remove the older IPC4 telemetry-specific debugfs implementation in favor of the new generic helper.
- Add the IPC4 debug-slot type constant for the debug stream slot.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sound/soc/sof/Makefile | Swap IPC4 telemetry debugfs object for the new generic debug-slot debugfs object. |
| sound/soc/sof/ipc4.c | Create debugfs nodes for telemetry/exception and debug stream slots; rate-limit missing-slot debug logging. |
| sound/soc/sof/ipc4-telemetry.h | Drop the now-removed exception debugfs node creation prototype. |
| sound/soc/sof/ipc4-telemetry.c | Remove telemetry-specific debugfs implementation (replaced by generic helper). |
| sound/soc/sof/ipc4-priv.h | Add prototype for the new generic debug-slot debugfs node helper. |
| sound/soc/sof/ipc4-debug-slot-debugfs.c | New generic debug-slot debugfs read implementation. |
| include/sound/sof/ipc4/header.h | Define SOF_IPC4_DEBUG_SLOT_DEBUG_STREAM slot type. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| void sof_ipc4_create_debug_slot_ro_debugfs_node(struct snd_sof_dev *sdev, u32 slot_type, | ||
| size_t data_offset, const char *name) | ||
| { | ||
| struct debug_slot_fs_ud *ud; | ||
| ud = devm_kzalloc(sdev->dev, sizeof(*ud), GFP_KERNEL); | ||
| if (!ud) | ||
| return; | ||
| ud->dfse.type = SOF_DFSENTRY_TYPE_IOMEM; | ||
| ud->dfse.size = SOF_IPC4_DEBUG_SLOT_SIZE; | ||
| ud->dfse.access_type = SOF_DEBUGFS_ACCESS_ALWAYS; | ||
| ud->dfse.sdev = sdev; | ||
| ud->slot_type = slot_type; | ||
| ud->data_offset = data_offset; | ||
| list_add(&ud->dfse.list, &sdev->dfsentry_list); | ||
| debugfs_create_file(name, 0444, sdev->debugfs_root, ud, &sof_debug_stream_fops); | ||
| } |
| } | ||
| sof_ipc4_create_exception_debugfs_node(sdev); | ||
| /* sizeof(u32)is for skiping the first separator magic number */ |
| } | ||
| dev_dbg(sdev->dev, "Slot type %#x is not available in debug window\n", slot_type); | ||
| dev_dbg_ratelimited(sdev->dev, "Slot type %#x is not available in debug window\n", slot_type); |
This commit simply maps the identified debug-stream debug window slot as a debugfs file.