Skip to content

ipc4: base_fw: runtime codec capability discovery for built-in and LLEXT modules - #11472

Draft
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/runtime-codec-info
Draft

lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/runtime-codec-info

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Remove build-time hardcoded per-codec #ifdef CONFIG_* capability entries from src/kernel/audio/base_fw.c and make firmware codec capabilities runtime-discoverable as built-in modules initialize and as LLEXT libraries are loaded or unloaded.

Changes

  1. Dynamic codec registry & runtime query IPC (<sof/audio/codec_info.h>, ipc4/base_fw.h, src/kernel/audio/base_fw.c)

    • Added a spinlock-protected codec_info_providers registry (sof_codec_info_register() / sof_codec_info_unregister()) that deduplicates (codec, dir) items into sof_ipc4_codec_info_data (up to SOF_IPC4_CODEC_INFO_MAX_ITEMS = 64).
    • Added IPC4_SOF_INFO_GET (37) to enum ipc4_base_fw_params and IPC4_SOF_CAPS (1) / IPC4_SOF_CAP_RUNTIME_SOF_INFO (BIT(0)) to allow the host to re-query SOF info TLVs at runtime.
    • Kept IPC4_FW_CONFIG emitting IPC4_SOF_CODEC_INFO (when non-empty) alongside IPC4_SOF_CAPS for backwards compatibility with older host drivers.
  2. LLEXT section discovery & library unload (lib_manager, llext_manager)

    • Added bounds-checked .sof_codec_info ELF section lookup (llext_manager_elf_find_section()) and codec registration/unregistration on library load (llext_manager_add_library()) and DRAM restore (llext_manager_restore_from_dram()).
    • Added llext_manager_remove_library() and lib_manager_unload_library() to safely unload inactive LLEXT libraries and unregister their codec entries.
  3. Per-module codec advertisement (ffmpeg_dec, mfcc, cadence_ipc4)

    • Moved codec capability definitions into each codec module: LLEXT builds embed SOF_CODEC_INFO_ITEM(codec, dir) arrays in .sof_codec_info, while built-in builds register during SOF_MODULE_INIT via sof_codec_info_register().

Backwards Compatibility

  • New FW + older Linux host: IPC4_FW_CONFIG still emits IPC4_SOF_CODEC_INFO for built-in modules; older hosts ignore IPC4_SOF_CAPS.
  • Older FW + new Linux host: paired with the kernel host discovery update, hosts fall back to boot-time FW_CONFIG when IPC4_SOF_CAP_RUNTIME_SOF_INFO is absent.

Verification

  • west build -b intel_adsp/ace30/wcl built cleanly with exit code 0 for:
    • Modular LLEXT configuration (CONFIG_LLEXT=y, CONFIG_COMP_FFMPEG_DEC=m, CONFIG_COMP_FFMPEG_DEC_STUB=y, CONFIG_COMP_MFCC=m)
    • Built-in configuration (CONFIG_COMP_FFMPEG_DEC=y, CONFIG_COMP_FFMPEG_DEC_STUB=y, CONFIG_COMP_MFCC=y)
  • scripts/check_kernel_includes.py --strict passed with 0 violations on the WCL LLEXT build.
  • Verified .sof_codec_info ELF sections in ffmpeg_dec.llext and mfcc.llext via objdump.
  • Runtime / on-device DSP verification has not yet been run (hence Draft PR).

Companion Linux host driver PR: thesofproject/linux#6044

… runtime IPC

Remove all build-time per-codec #ifdef checks from get_codec_info() in
base_fw.c and introduce a spinlock-protected dynamic codec registry
declared in <sof/audio/codec_info.h>.

Add IPC4_SOF_INFO_GET (base firmware parameter 37) and capability flag
IPC4_SOF_CAP_RUNTIME_SOF_INFO under IPC4_SOF_CAPS so hosts can re-query
SOF info TLVs at runtime after LLEXT libraries are loaded or unloaded.
IPC4_FW_CONFIG continues to emit IPC4_SOF_CODEC_INFO (when populated)
and IPC4_SOF_CAPS for backwards compatibility with older host drivers.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…ilities dynamically

Parse the optional ".sof_codec_info" ELF section when loading or
DRAM-restoring an LLEXT library and register its codec items with
base_fw's runtime codec registry. Add lib_manager_unload_library() and
llext_manager_remove_library() so idle LLEXT libraries can be safely
unloaded and their codec entries unregistered.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
… LLEXT

Move codec capability declarations out of base_fw.c into the respective
codec modules (ffmpeg_dec, mfcc, cadence_ipc4): embed ".sof_codec_info"
tables in LLEXT builds and register built-in codec tables during
SOF_MODULE_INIT via sof_codec_info_register().

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