Skip to content

up_down_mixer: refuse to load without the HiFi3 mix routines - #11625

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/up-down-mixer-no-panic
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/up-down-mixer-no-panic

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Make the up/down mixer fail to load instead of crashing the DSP when it is built without its mix routines.

The mix routines are only implemented with the HiFi3 intrinsics of the Cadence compiler (#if defined(__XCC__) && XCHAL_HAVE_HIFI3). Every other build, including the Zephyr SDK GCC builds of all the Intel platforms, which enable CONFIG_COMP_UP_DOWN_MIXER, replaces all 29 routines with stubs that call sof_panic(0). The first block of audio such an instance processes therefore crashes the DSP.

Changes

  • up_down_mixer.h defines UP_DOWN_MIXER_HAVE_ROUTINES from the existing condition, and up_down_mixer_hifi3.c uses it.
  • Without the routines, up_down_mixer_init() logs an error and returns -ENOTSUP, so the pipeline that uses the module fails to load with a message instead of crashing the DSP later.
  • The stubs are now never called, so they are left empty.

No in-tree topology uses the module.

Functional change

  • GCC (and host) builds: the module fails to load instead of crashing the DSP when it processes audio.
  • HiFi3 (Cadence) builds: unchanged.

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. Only up_down_mixer.c and up_down_mixer_hifi3.c change, in the Intel builds that enable the module; the up/down mixer code of the Cadence builds is unchanged.
  • 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

The mix routines are only implemented with the HiFi3 intrinsics of the
Cadence compiler. Every other build, including the Zephyr SDK GCC builds
of all the Intel platforms, which enable CONFIG_COMP_UP_DOWN_MIXER,
replaces them with stubs that call sof_panic(0), so the first block of
audio that such an instance processes crashes the DSP.

Fail the module init with -ENOTSUP in those builds instead, so that
the pipeline that uses the module fails to load with an error message.
The stubs are now never called, so leave them empty.

The HiFi3 builds are unchanged.

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