Skip to content

WIP: Userspace LL ztest#10576

Draft
lgirdwood wants to merge 56 commits intothesofproject:mainfrom
lgirdwood:qemudc233c-pipe
Draft

WIP: Userspace LL ztest#10576
lgirdwood wants to merge 56 commits intothesofproject:mainfrom
lgirdwood:qemudc233c-pipe

Conversation

@lgirdwood
Copy link
Copy Markdown
Member

Very basic/simple ztest to start with user LL. For developers only, lots still todo. Includes qemu support for dc233c atm.

(.venv) lrg@moth:~/work/sof/build-qemu_xtensa_mmu$ west build -t run
-- west build: running target run
[0/27] cmake -P /home/lrg/work/sof/sof/scripts/cmake/version.cmake
-- SOF version.cmake starting at 2026-02-24T20:54:21Z UTC
-- /home/lrg/work/sof/sof/ is at git commit with parent(s):
commit 31248867b7d03507a44c4383bbfeb91993ad0254 7bee513d082b5e058f2accb3bde00c2c7907b439 (HEAD -> qemudc233c-pipe, lrg/qemudc233c, qemudc233c)
Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Date:   Tue Feb 24 15:38:55 2026 +0000

    boot tests: add support for running boot tests on qemu simulator
    
    Call directly here as more qemu target wont simulate IPC which is used
    as entry for testing on HW.
    
    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
-- GIT_TAG / GIT_LOG_HASH : v2.14-pre-rc-427-g31248867b7d0-dirty / 31248867b
-- Source content hash: 412cbc68. Notes:
  - by design, source hash is broken by Kconfig changes. See #3890.
  - Source hash is also broken by _asymmetric_ autocrlf=input, see
    #5917 and reverted #5920.
-- Unchanged /home/lrg/work/sof/build-qemu_xtensa_mmu/zephyr/include/generated/sof_versions.h
[1/2] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: dc233c
[    0.017126] <inf> init: FW ABI 0x301d001 DBG ABI 0x5003000 tags SOF:v2.14-pre-rc-427-g31248867b7d0-dirty zephyr:v4.3.0-5654-gf6a32b27dc17 src hash 0x412cbc68 (ref hash 0x412cbc68)
[    0.022360] <inf> ipc: SOF_BOOT_TEST_STANDALONE, disabling IPC.
*** Booting Zephyr OS build v4.3.0-5654-gf6a32b27dc17 ***
[    0.022566] <inf> main: SOF on qemu_xtensa
[    0.022584] <inf> main: SOF initialized
Running TESTSUITE sof_boot
===================================================================
START - test_sys_sem
[    0.028553] <inf> sof_boot_test: SOF thread UserSpace! (qemu_xtensa/dc233c/mmu) sem 0x1aa000: 0
 PASS - test_sys_sem in 0.007 seconds
===================================================================
START - user_space
[    0.129540] <inf> sof_boot_test: SOF thread UserSpace! (qemu_xtensa/dc233c/mmu)
[    0.140062] <inf> sof_boot_test: SOF thread UserSpace! (qemu_xtensa/dc233c/mmu)
 PASS - user_space in 0.012 seconds
===================================================================
TESTSUITE sof_boot succeeded
Running TESTSUITE userspace_ipc4_pipeline
===================================================================
START - test_pipeline_create_destroy_handlers
[    0.241230] <inf> sof_boot_test: Starting IPC4 pipeline test (handlers)
[    0.241251] <inf> pipe: pipeline new pipe_id 2 priority 0
[    0.241376] <inf> sof_boot_test: IPC4 pipeline test (handlers) complete
 PASS - test_pipeline_create_destroy_handlers in 0.001 seconds
===================================================================
START - test_pipeline_create_destroy_helpers
[    0.341912] <inf> sof_boot_test: Starting IPC4 pipeline test (helpers)
[    0.341931] <inf> pipe: pipeline new pipe_id 1 priority 0
[    0.342072] <inf> sof_boot_test: IPC4 pipeline test (helpers) complete
 PASS - test_pipeline_create_destroy_helpers in 0.001 seconds
===================================================================
TESTSUITE userspace_ipc4_pipeline succeeded
Running TESTSUITE userspace_ll
===================================================================
START - ll_task_test
 SKIP - ll_task_test in 0.001 seconds
===================================================================
TESTSUITE userspace_ll succeeded
Running TESTSUITE userspace_mailbox
===================================================================
START - mailbox_test
 SKIP - mailbox_test in 0.001 seconds
===================================================================
TESTSUITE userspace_mailbox succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [sof_boot]: pass = 2, fail = 0, skip = 0, total = 2 duration = 0.019 seconds
 - PASS - [sof_boot.test_sys_sem] duration = 0.007 seconds
 - PASS - [sof_boot.user_space] duration = 0.012 seconds

SUITE PASS - 100.00% [userspace_ipc4_pipeline]: pass = 2, fail = 0, skip = 0, total = 2 duration = 0.002 seconds
 - PASS - [userspace_ipc4_pipeline.test_pipeline_create_destroy_handlers] duration = 0.001 seconds
 - PASS - [userspace_ipc4_pipeline.test_pipeline_create_destroy_helpers] duration = 0.001 seconds

SUITE SKIP -   0.00% [userspace_ll]: pass = 0, fail = 0, skip = 1, total = 1 duration = 0.001 seconds
 - SKIP - [userspace_ll.ll_task_test] duration = 0.001 seconds

SUITE SKIP -   0.00% [userspace_mailbox]: pass = 0, fail = 0, skip = 1, total = 1 duration = 0.001 seconds
 - SKIP - [userspace_mailbox.mailbox_test] duration = 0.001 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL
QEMU: Terminated

@lgirdwood lgirdwood force-pushed the qemudc233c-pipe branch 3 times, most recently from d7d6b73 to 77fa25d Compare March 12, 2026 21:00
@lgirdwood
Copy link
Copy Markdown
Member Author

@kv2019i @jsarha @lyakh fyi - still WIP but can run pipelines on qemu, will be splitting up to upstream.

lrgirdwo and others added 26 commits March 27, 2026 18:58
Add native_sim board configuration and support in the build script.
This allows building and running tests on the host using Zephyr's
native_sim target.

native_sim leverages the POSIX architecture, but the libfuzzer
support specifically requires CONFIG_ARCH_POSIX_LIBFUZZER to be set.
Therefore, this wraps fuzzer-specific code in ipc.c and the build
of fuzz.c behind this config to allow clean compilation on the
standard native_sim board.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add native_sim board target to the sof-qemu-run scripts, and add an
option to additionally run it under valgrind.

The default build directory is set to ../build-native_sim

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
When building the firmware for native_sim, debugging allocations with
host machine tools like Valgrind is constrained due to Zephyr's
internal minimal libc tracking the heap manually via static pools. By bypassing
Zephyr's memory interception on native_sim using nsi_host_malloc,
dynamically tracked memory can surface appropriately to Valgrind memory
checkers without causing a libc heap pool panic.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
In file included from /home/lrg/work/sof2/sof/zephyr/sof_shell.c:14:
/home/lrg/work/sof2/sof/zephyr/sof_shell.c: In function 'cmd_sof_module_heap_usage':
/home/lrg/work/sof2/sof/zephyr/sof_shell.c:66:77: error: 'struct module_config' has no member named 'heap_bytes'
   66 |                             icd->id, usage, hwm, comp_mod(icd->cd)->priv.cfg.heap_bytes);
      |                                                                             ^
/home/lrg/work/sof2/zephyr/include/zephyr/shell/shell.h:1292:47: note: in definition of macro 'shell_print'
 1292 |         shell_fprintf_normal(_sh, _ft "\n", ##__VA_ARGS__)
      |                                               ^~~~~~~~~~~

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Keep spinning in case user needs to inspect status via monitor.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The DAI_INTEL_UAOL configuration might not be present in Zephyr
headers (or certain Zephyr branches), leading to build failures.
Wrap its usage in SOF_DAI_INTEL_UAOL cases to ensure older or
different Zephyr versions still compile successfully.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
When building the native_sim fuzzer, the host allocator does not
possess the strict bounds of the internal Zephyr memory pools. If
the fuzzer generates a malformed payload requesting an excessively
large size (e.g. 4GB), it passes directly to the host ASAN allocator
which aborts due to OOM or protection limits. Adding a 16MB cap
allows these to fail gracefully.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The fuzzer's payload size posix_fuzz_sz is provided by libFuzzer as
a size_t. Declaring it as a uint8_t in the ipc test harness resulted
in silent payload truncation (maximum 255 bytes) causing incomplete
corpus generation. This corrects the types between fuzz.c and ipc.c.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Make the maths tests available on native sim target.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Run the boot tests and quit when done.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add some high level descriptiond of topology 1 & 2

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Enable CONFIG_LOG_CORE_ID_PREFIX on all Intel ADSP targets. This new
Zephyr logging feature (introduced in commit e254a97cf15) prepends the
core ID to each log message, which helps distinguish log output from
different DSP cores in multicore ACE platforms.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Do not send IPC in case SOF is built with CONFIG_SOF_BOOT_TEST_STANDALONE
and IPC subsystem is not fully initialized.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This patch moves formats definitions for the objects in
pipeline compr-playback to separate include files in new
directory include/formats.

It avoids duplication of same input and output formats several
times and prepares to add new formats and sample rates later.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The purpose of this patch is to add conversion of possible mono
output from decoder to stereo format in the selector (micsel)
module. If the decoded output is stereo, the selector goes to
pass-through mode with minimal impact to processing load.

This patch adds the mono format to all needed objects (host-copier,
decoder, module-copier, src, input of selector). Selector has
single stereo, S32_LE, 48 kHz output format.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds to stft_process-hifi3.c the HiFi3 versions of
higher complexity functions stft_process_apply_window() and
stft_process_overlap_add_ifft_buffer().

The functions with no clear HiFi optimization benefit are moved
from stft_process-generic.c to stft_process_common.c. Those
functions move data with practically no processing to samples.

The stft_process_setup() function is changed to allocate buffers
with mod_balloc_align() to ensure a 32-bit sample pair or complex
number is aligned for 64 bit xtensa SIMD. This patch also adds
checks to other parameters to ensure the STFT is set up in a
way that can be executed.

The patch also fixes a too large allocation in setup. The window
function buffer allocation is common for all channels. It should
not be multiplied by channels count.

This change saves 17 MCPS (from 63 MCPS to 46 MCPS). The test
was done with script run:

scripts/rebuild-testbench.sh -p mtl
scripts/sof-testbench-helper.sh -x -m stft_process_1024_256_ \
  -p profile-stft_process.txt

The above STFT used FFT length 1024 with hop 256.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch removes fill_start_idx member from struct stft_process_fft.
It would have required another check for data align and samples amount
for Xtensa HIFI SIMD code version. There is no need for different FFT
padding types (left, center, right as in MFCC) in this component, so
it's safe to remove.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch optimizes the cycle count of the radix-2 Cooley-Tukey
implementation with three changes:

- Dedicated depth-1 stage: all N/2 butterflies use a real twiddle
  factor W^0 = 1+0j, so the complex multiply is replaced by plain
  add or subtract.

- Skip multiply for j=0 in stages >= 2: The first butterfly in every
  group also uses W^0, saving an additional ~N/2 complex multiplications
  across all remaining stages.

- Pointer arithmetic: replace per-butterfly index arithmetic
  (outx[k+j], outx[k+j+n], twiddle[i*j]) with auto-incrementing
  pointers and strided twiddle access (tw_r += stride), eliminating
  integer multiplies for address computation.

This change saves 11 MCPS (from 74 MCPS to 63 MCPS) in STFT Process
module in MTL platform with 1024/256 size/hop FFT processing. It was
tested with scripts:

scripts/rebuild-testbench.sh -p mtl
scripts/sof-testbench-helper.sh -x -m stft_process_1024_256_ \
  -p profile-stft_process.txt

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds HiFi3 versions for functions dft3_32() and
fft_multi_execute_32(). The functions are implemented to
fft_multi_hifi3.c and the generic versions are moved to
fft_multi_generic.c.

in MTL platform the optimization saves 119 MCPS, from 237 MCPS
to 118 MCPS. The test was done with script run:

scripts/rebuild-testbench.sh -p mtl
scripts/sof-testbench-helper.sh -x -m stft_process_1536_240_ \
  -p profile-stft_process.txt

The above STFT used FFT length of 1536 with hop 240.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
- document directory structure, class-based object model, and build pipeline
- add PCM ID and pipeline ID convention tables for Intel SoundWire and HDA
- describe cmake target registration, platform overrides, and route definitions

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Keep the per-thread stack and cpu LOG_DBG print and add a separate
LOG_INF that fires only for the Zephyr idle thread. The info-level
print reports per-core CPU utilization calculated as the inverse of
the idle thread load percentage.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
On certain platforms, such as Intel PTL, memory limitations prevent the
creation of two instances simultaneously on both the speaker and
headphone pipelines. Therefore, new configuration SSP_HEADSET_DAX for
cavs-rt5682 and SDW_JACK_PIPELINE_SRC for cavs-sdw have been added to
allow users to decide whether to enable DAX on both the speaker and
headphone pipelines based on the platform's capabilities.

Additionally, to maintain the readability of the cavs-sdw configuration
file, the sdw-dax files for the speaker and headphone have been
separated into their own files.

sdw-amp-dax.conf: Based on sdw-amp-generic.conf, remove all logic where
PASSTHROUGH is set to true and SDW_SPK_ENHANCED_PLAYBACK is set to false,
and add the dolby-dax widget

sdw-jack-dax.conf: Based on sdw-jack-generic.conf, remove all logic
where PASSTHROUGH is set to true and SDW_SPK_ENHANCED_PLAYBACK is set
to false, and add the dolby-dax widget

Signed-off-by: Jun Lai <jun.lai@dolby.com>
High level information about how IPC works and some specifics for
IPC3 and IPC4 protocols.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Move the initialization of `bsource_list`, `bsink_list`, and performance
tracking telemetry data from `comp_new_ipc4()` directly into
`ipc4_add_comp_dev()`.

This refactoring centralizes core component setup logic deeper into the
device addition routine, allowing it to be directly leveraged by mock
component setups (like the Zephyr usermode IPC pipeline tests). This
ensures manual test components correctly initialize their data structures
via core infrastructure APIs instead of relying on redundant manual list
tracking, promoting better API safety and reusability.

As a result, `ipc4_add_comp_dev()` is now defined in `component_ext.h`
as a globally accessible symbol, dropping its static scope.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the aria module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the asrc module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lrgirdwo added 29 commits March 31, 2026 12:44
Add the ztest framework test cases for the copier module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the crossover module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the dcblock module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the google module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the igo_nr module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the level_multiplier module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the mfcc module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the mic_privacy_manager module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the mixin_mixout module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the multiband_drc module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the nxp module, validating
component instantiation and evaluation configuration structs bindings. Contains
fixes to eap_stub.c mitigating uninitialized trace string pointer dereference.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the rtnr module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the smart_amp module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the sound_dose module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the src module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the stft_process module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the tdfb module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the tensorflow module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the tone module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the ztest framework test cases for the up_down_mixer module, validating
component instantiation and evaluation configuration structs bindings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Define new connector node ID types for QEMU test input and output
classes, and add a QEMU gateway type. Also expose pipeline creation
and deletion functions globally to support testing in userspace.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add a new QEMU gateway implementation to the copier component to
facilitate userspace pipeline testing. This allows the copier to
interface directly with the QEMU test environment, handling input and
output classes specific to QEMU.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add zassert_not_null checks to userspace tests for Intel HDA DMA and SSP
DAI. This verifies that the retrieved DMA and DAI device pointers are valid
and not null before attempting to use them in the test cases.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Refactor test_ipc4_pipeline.c by splitting it into a common utility header
and source file, alongside dedicated test files for native and user space.
This improves code organization and separates test execution environments.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fix compilation and linker errors caused by missing extern declarations, LLEXT stubs, PM definitions, and logging structures when PM/LLEXT/LOG are conditionally disabled on the simulator boards. Remove CACHED_BOARD overwrite in QEMU python runner script.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Since Zephyr's west runner doesn't generate a run target for the custom intel_ace QEMU emulator out of the box, we bypass west run entirely for PTL and WCL. The python runner now uses the explicitly requested intel_ace QEMU binary with the adsp_ace30 machine and zephyr.ri firmware image.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add the required Kconfig flags (`CONFIG_ZTEST`, `CONFIG_SOF_BOOT_TEST_STANDALONE`, and userspace driver configurations) to enable the Zephyr testing framework on the PTL simulator. Include all necessary audio component mocks to prevent linker errors when compiling the test suite. Additionally, fix an undeclared `ll_tr` trace symbol error in `zephyr_ll_user.c` by including the scheduler header.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Update the QEMU invocation for ACE30 targets (e.g. PTL, WCL) to exactly match the default execution requirements. Remove the redundant `-cpu` argument and export `QEMU_ACE_MTRACE_FILE=/tmp/ace-mtrace.log` into the environment to ensure mailbox and mtrace logs are properly routed and captured by the emulator during simulation.

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.

6 participants