Skip to content

kernel: use k_panic() instead of sof_panic() - #11622

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/zn-rtos-panic-kernel
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/zn-rtos-panic-kernel

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Use k_panic() instead of sof_panic() in the kernel code. Part of #11517 (step 6).

Kernel code uses the native Zephyr API, while user code keeps the SOF and POSIX ones. On Zephyr, sof_panic() is defined as k_panic() and drops its panic code. This converts the remaining kernel callers: the IPC core (ipc-common-kernel.c), the system agent and the i.MX IPC driver (8 sites). The host gets k_panic() from rtos/panic.h (#11583).

Not in this PR

User code keeps sof_panic().

Functional change

None on Zephyr. On the host, these panics report SOF_IPC_PANIC_ASSERT instead of the IPC or idle panic code; the host panic handler aborts without using the code.

Testing

Tested as a stack of the four Wave D PRs on main 73a7797 (this PR does not depend on the others):

  • Builds: every commit built incrementally and the tip from scratch, for tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, nvl-s, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx93, imx95, qemu_xtensa, qemu_xtensa_mmu, native_sim, and the PTL userspace, LL-userspace and LLEXT, MTL LLEXT, TGL/PTL debug-stream and TGL/MTL/LNL/PTL CI overlay configurations.
  • Objects: every object hashed with the debug sections stripped and compared commit by commit. No object changes, apart from the objects that embed the git version.
  • Platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365, phyboard): same error sets, and the same header dependencies.
  • Cadence xt-clang: MTL, PTL and NVL compile.
  • Host: the host library builds, and ZTest passes 38 of 38, run as in CI.
  • checkpatch: clean.

🤖 Generated with Claude Code

Kernel code uses the native Zephyr API, while user code keeps the SOF
and POSIX ones. On Zephyr, sof_panic() is defined as k_panic() and drops
its panic code. Call k_panic() directly in the remaining kernel code:
the IPC core, the system agent and the i.MX IPC driver. The host
provides k_panic() through rtos/panic.h.

No functional change on Zephyr. On the host, these panics report
SOF_IPC_PANIC_ASSERT instead of the IPC or idle panic code; the host
panic handler aborts without using the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.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.

2 participants