Skip to content

audio: webrtc: build WebRTC audio processing modules as standalone LLEXTs - #11520

Merged
lgirdwood merged 9 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-llext-split
Nov 29, 2026
Merged

lgirdwood merged 9 commits into
thesofproject:mainfrom
lgirdwood:topic/webrtc-llext-split

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Convert all six WebRTC audio processing modules from LIB openmodules (bundled inside sof-<plat>-openmodules.ri) into individual standalone .llext modules with dedicated <UUID>.bin symlinks:

  • webrtc_aec.llext (e5da7b5b-133a-ba46-b517651d6300bb83)
  • webrtc_agc.llext (0af7b529-9dc7-4bee-a8b159e8fbe414f3)
  • webrtc_hpf.llext (6dfb1bea-d858-4ef7-92abcf5b4ee48159)
  • webrtc_ns.llext (0fc8faef-945f-004b-8d5f315047f1136a)
  • webrtc_ns2.llext (eacfacdc-2a87-c942-97e894c917a740db)
  • webrtc_vad.llext (c790b11d-5d14-e54e-be36ba4ad732cc14)

Sequential module_size VMA advancement is preserved so multiple WebRTC stages (e.g. HPF -> AEC -> NS/NS2 -> AGC -> VAD) can load and run concurrently in a single capture pipeline.

Dependencies

Verification

  • Hardware verified on Damsel Fly (PTL / ACE 3.0) (CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y):
    • webrtc_aec.llext loaded standalone from sof-ipc4-lib/ptl/community/e5da7b5b-....bin, initialized the aecm backend in DP userspace with heap_bytes_requirement 262144, and captured 192044 bytes cleanly via arecord.
  • Build & Static Checks (intel_adsp/ace30/ptl, CONFIG_COMP_BT_CODEC=n locally):
    • CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y (webrtc_overlay.conf): all 6 standalone .llexts built and signed cleanly with rimage (module_size=0xbc000, fits default 0x100000 library region), zero missing imports against llext_const_symbol_area.
    • CONFIG_LLEXT_TYPE_ELF_SHAREDLIB=y (webrtc_overlay.conf): all 6 standalone .llexts built and signed cleanly with rimage (module_size=0x131000), zero missing .dyn-syms against llext_const_symbol_area.
    • webrtc_aec Float backend (CONFIG_WEBRTC_AEC_BACKEND_FLOAT=y, =m): built and signed cleanly with zero missing exports.
    • webrtc_stubs_overlay.conf (=m + STUB=y) and all 6 built-in (=y with float AEC): built cleanly.

Related

@lgirdwood
lgirdwood force-pushed the topic/webrtc-llext-split branch 2 times, most recently from 473f6f9 to 8306d61 Compare November 28, 2026 21:38

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix commit messages fro correct line wrap, code is for ipc4 only.

Comment thread src/audio/webrtc_ns/webrtc_ns-shims.c Outdated


float fabsf(float x)
__attribute__((weak)) float fabsf(float x)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is a STB_WEAK linkage gap in Zephyr that needs fixed here, lets mark this as a TODO

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marked the Zephyr llext_link_plt() STB_WEAK relocation workaround with explicit TODO comments in webrtc_ns-shims.c and webrtc_ns2-shims.c (matching webrtc_aec-math.c).

Comment thread src/include/sof/lib/notifier.h Outdated
Comment on lines +91 to +101
#if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION)
#include <sof/compiler_attributes.h>

__syscall void notifier_event(const void *caller_id, enum notify_id event_type,
uint32_t core_mask, void *caller_data, uint32_t data_size);
#include <zephyr/syscalls/notifier.h>
#else
void z_impl_notifier_event(const void *caller_id, enum notify_id event_type,
uint32_t core_mask, void *caller_data, uint32_t data_size);
#define notifier_event z_impl_notifier_event
#endif

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls have a look at main branch KPB and intel/wov-uaol-d0i3 branch as notifier is deprecated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted all notifier_event syscall additions (notifier.h, notifier.c, zephyr/syscall/notifier.c, zephyr/CMakeLists.txt) and removed the deprecated notifier_event(NOTIFIER_ID_VAD) calls from webrtc_vad.c and webrtc_ns2.c, replacing them with transition state tracking / comp_dbg() and a TODO to wire future consumers via AMS, Zephyr k_msgq (as in kpb.c), or IPC4 control notifications.

Comment thread src/audio/webrtc_aec/webrtc_aec.c Outdated
}
webrtc_aec_reset_resamplers(cd);

#ifdef CONFIG_IPC_MAJOR_4

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be ipc4 only

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed #ifdef CONFIG_IPC_MAJOR_4 and consolidated the duplicate reference pin format update in webrtc_aec.c, and added depends on IPC_MAJOR_4 across all remaining WebRTC module Kconfigs (webrtc_agc, webrtc_hpf, webrtc_ns, webrtc_ns2, webrtc_vad).

Compile external WebRTC static libraries (AECm, NS, RNNoise, libfvad)
with -fno-pic -fno-pie -mlongcalls -mtext-section-literals -DNDEBUG when
building relocatable Xtensa LLEXTs. Without these flags, GCC emits
R_XTENSA_PLT internal relocations that the Zephyr LLEXT loader cannot
resolve against static archive symbols.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Zephyr sets LL_EXTENSION_BUILD rather than LLEXT_MODULE when compiling
relocatable LLEXT sources; check both macros in the WebRTC shims and
in webrtc_vad-fvad.c's webrtc_vad_set_active_mod() declaration so
active_vad_mod, malloc/free wrappers, and non-userspace BSS placement
match the build mode. Also remove the unused <rtos/panic.h> include and
k_panic() call from webrtc_aec-shims.c.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Provide __attribute__((weak)) soft-float logf, log10f, expf, cosf, sinf,
and atanf shims compiled unconditionally so both relocatable LLEXT and
built-in IPC4 firmware builds link without an external libm or
duplicate symbol collisions. Implement log2f and exp2f via range
reduction into [sqrt(2)/2, sqrt(2)] and [-0.5, 0.5] so inputs across
the full positive domain stay accurate and continuous.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Remove notifier_event(NOTIFIER_ID_VAD) calls from webrtc_vad and
webrtc_ns2 instead of exposing notifier_event() as a Zephyr syscall.
The SOF notifier bus is deprecated and not usable from userspace
LLEXTs; no consumer registers for NOTIFIER_ID_VAD, and future consumers
should use AMS, a Zephyr k_msgq (as in KPB), or an IPC4 control
notification instead.

Keep last_decision/last_vad state tracking and log transitions via
comp_dbg() with a TODO marker.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Drop 'LIB openmodules' from all six WebRTC module LLEXT builds
(webrtc_aec, webrtc_agc, webrtc_hpf, webrtc_ns, webrtc_ns2, webrtc_vad)
so each builds and signs as an individual <mod>.llext with its
<UUID>.bin symlink instead of being bundled inside
sof-<plat>-openmodules.ri.

Each standalone module keeps sequential module_size VMA advancement so
multiple WebRTC stages (e.g. HPF -> AEC -> NS/NS2 -> AGC -> VAD) can
load and run concurrently in the same capture pipeline (total 0xbc000 on
PTL relocatable). Also mark all WebRTC modules as IPC4-only via
depends on IPC_MAJOR_4 in Kconfig, matching webrtc_aec and their
unconditional <ipc4/header.h> usage.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Support both 16-bit and 32-bit PCM formats cleanly across
webrtc_{aec,agc,hpf,ns,vad}, remove redundant #ifdef CONFIG_IPC_MAJOR_4
and duplicate pin format updates in webrtc_aec (IPC4 only), make LLEXT
soft-float math shims non-weak with safe Newton sqrtf in
webrtc_ns-shims.c and webrtc_aec-math.c (marking the Zephyr
llext_link_plt() STB_WEAK gap with TODO comments), and preserve
multi-format routing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Mark the LLEXT weak-symbol workaround in webrtc_ns2-shims.c with a TODO
comment for Zephyr STB_WEAK relocation support, add RNNoise scratch
pre-init and OOM NULL checks, and switch webrtc_ns2 to the DP domain
with required stack/heap sizes and updated topology UUID.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Update rnnoise from 24dbb35115c6 to 5bd733d7a950 to bring in rnnoise
scratch pre-initialization and OOM allocation guards required by
webrtc_ns2:

5bd733d rnnoise: add scratch pre-init and OOM allocation guards

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Extract compiler archiver and Xtensa target/PIC flag resolution into
scripts/cmake/xtensa_ext_cc.cmake for the four WebRTC standalone LLEXT
external library builds, adding Clang target/mcpu/sysroot support and
avoiding duplicated flag logic.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
@lgirdwood
lgirdwood force-pushed the topic/webrtc-llext-split branch from 8306d61 to 6cee312 Compare November 29, 2026 10:44
@lgirdwood

Copy link
Copy Markdown
Member Author

Updated topic/webrtc-llext-split (head 6cee31251) to address all review feedback:

  1. Notifier deprecation: Dropped the notifier_event syscall changes (notifier.h, notifier.c, zephyr/syscall/notifier.c, zephyr/CMakeLists.txt now untouched vs origin/main) and removed deprecated notifier_event(NOTIFIER_ID_VAD) calls from webrtc_vad.c and webrtc_ns2.c, keeping transition tracking + TODO comments pointing to AMS / Zephyr k_msgq (like KPB) / IPC4 notifications.
  2. STB_WEAK TODO: Added explicit TODO comments around the STB_WEAK LLEXT shim workarounds in webrtc_ns-shims.c and webrtc_ns2-shims.c (matching webrtc_aec-math.c).
  3. IPC4-only scope: Removed #ifdef CONFIG_IPC_MAJOR_4 and the duplicate ipc4_update_source_format() block in webrtc_aec.c, and added depends on IPC_MAJOR_4 to webrtc_{agc,hpf,ns,ns2,vad}/Kconfig.
  4. Commit message wrapping: Wrapped all commit subjects and body lines cleanly within 72 characters.

Rebuilt both PTL intel_adsp/ace30/ptl real and stub WebRTC LLEXT targets cleanly, and verified webrtc_hpf, webrtc_agc, webrtc_vad, webrtc_ns, and webrtc_aec capture/playback on Damsel Fly with clean dmesg.

@lgirdwood
lgirdwood marked this pull request as ready for review November 29, 2026 13:44
@intel-sofci

Copy link
Copy Markdown

PR 11520: test results

Run date: 2026-11-29 14:25 UTC

Tested commit: 6cee312517be662b92c64e5f97733fe8da22338f

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lgirdwood
lgirdwood merged commit ac78bba into thesofproject:main Nov 29, 2026
45 of 46 checks passed
@lgirdwood
lgirdwood deleted the topic/webrtc-llext-split branch November 29, 2026 14:51
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.

3 participants