Commit Graph

12032 Commits

Author SHA1 Message Date
Laurentiu Mihalcea 87558f8260 audio: dai-zephyr: Set source/destination address adjustment
Some DMACs (e.g: NXP's EDMA) can automatically adjust the source and
destination addresses upon transfer completion. As such, we need to
indicate how the adjustment should be performed. In the case of playback,
the source address should be decremented, while in the case of capture,
the destination address should be decremented.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 2c56be62ab audio: dai-zephyr: Allow dai_set_config() to work for NXP's SAI
Since now there's a Zephyr driver for NXP's SAI, the dai_set_config()
should be modified to also allow the configuration of the SAI.
As such, this commit introduces a new case for NXP's SAI that does
exactly that.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 4887b777a6 lib: dma: Add entries for i.MX93's EDMA and HOST DMAs
Since the EDMA and HOST DMA nodes have been introduced to
the i.MX93 overlay, add entries in the dma array which will
create a struct dma for each of these DMACs.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 237a2faca4 lib: dai: Add entry for NXP's SAI
Since the Zephyr SAI driver is now enabled, add an entry in
the zephyr_dev array, which will resolve to multiple
"struct device *", one for each SAI node specified in the DTS.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea c375a95245 audio: host-zephyr: Set SRC/DEST addresses during host_common_params()
Source and destination addresses cannot be NULL. As such,
set them to the values found in the first element of
hd->config's elem_array. This is fine to do because the host
component uses only 1 block.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea b0de76420e audio: host-zephyr: Update DMA block configuration when re-configuring
With every copy() operation, the source and destination addresses
keep getting modified. As such, for each re-configuration performed
during host_copy_one_shot(), the HOST DMAC needs to be made
aware of these changes.

This commit changes host_copy_one_shot() such that on each
dma_config() call the DMAC driver receives the updated
addresses and size.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 886026ea85 ipc3: host-page-table: Add native version for ipc_get_page_descriptors()
Since the DMAC is configured in a somewhat different way in the
native case vs the non-native case, add a native version of the
ipc_get_page_descriptors() function and remove the Zephyr-specific
functions from the non-native version of said function.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Guennadi Liakhovetski 980b1c64f2 smart-amp-test: make a loadable module
Convert the smart-amp-test in its IPC4 version to a loadable LLEXT
module. Use an overlay configuration to select between monolithic and
modular builds.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 6b9b4c24d2 modules: don't re-load on each restart
While modules are in use, no need to unload and re-load them,
re-initialising audio interfaces is enough. With llext modules this
uses the LLEXT reference counting to identify when a module should be
unloaded.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 5d202ba726 modules: split modules_init() into two parts
The first part modules_new() is only needed when a new module is
registered, the rest is needed every time a module is instantiated.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 1481770a0e lib-manager: use an appropriate type for a pointer integer
lib_manager_allocate_module() returns a pointer as an integer, use
uintptr_t for it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski ca29bfb895 module: (cosmetic) regroup some declarations and assignments
Regroup code in modules_init() to move declarations and assignments
closer to where they're needed.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 9db256806c lib-manager: fix a wrongly named .desc pointer
Pointers that we store in a global array for each loaded library,
aren't really firmware manifest descriptor pointers, they're pointers
to storage buffers, where entire libraries are stored. A
SOF_MAN_ELF_TEXT_OFFSET offset has to be added to that address to get
to the manifest descriptor.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski bf1dfb40fb module-adapter: add Zephyr extension context
Module adapter drivers can be loaded and unloaded, using the Zephyr
loadable extension API. Add its context to struct struct module_data.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 6de605d737 lib-manager: migrate to module adapter context
lib-manager is module-adapter specific, it doesn't need the component
API and shouldn't use struct comp_driver in function arguments.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Guennadi Liakhovetski 4d3c2ee51f lib-manager: add support for llext
Add support for loadable modules, built for dynamic linking with
Zephyr's LLEXT API.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-08 16:25:28 +02:00
Andrula Song e48a171837 Audio: DRC: DRC math function optimization.
Use the xtense intrinsic instrunctions directly can save
at least 10% cycles for those functions, and save about
0.9mcps for DRC component.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 14:24:40 +00:00
Marc Herbert 342d5d0259 .github/zephyr: upgrade deprecated actions/cache@v3.0.11 to v4
Fixes a lot of instances of this warning:

Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: actions/cache@v3.0.11. For more information see:
https://github.blog/changelog/
  2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-08 13:51:26 +00:00
Marc Herbert e29d4bc390 .github: upgrade deprecated upload-artifact@v3 to v4
Fixes a lot of instances of this warning:

Node.js 16 actions are deprecated. Please update the following actions
to use Node.js 20: actions/upload-artifact@v3. For more information see:
https://github.blog/changelog/
  2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-08 13:51:26 +00:00
Kai Vehmanen 22b3518601 west.yml: update Zephyr to f9f44b6dcdd
Switch back to main Zephyr repository and commit f9f44b6dcdd.

This includes following squashed SOF commits that are
needed to adapt to HWMv2 changes in Zephyr:

zephyr: app: scripts: intel_adsp: change board names to HWMv2
zephyr: sof: update board name for HWMv2
zephyr: intel_adsp: Change ACE SoC name to HWMv2
app: boards: imx93: updates for zephyr hwmv2

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-08 13:16:58 +02:00
Kai Vehmanen 7507b32e3b west.yml: update Zephyr to 9d1df132b1c + one revert
Update to Zephyr in sof/main-rebase-20240305 branch of SOF
project's clone of Zephyr upstream repository. Revert one
Zephyr commit "pm: Remove CURRENT_CPU macro" that is leading to
failed tests in SOF CI test suite.

The revert allows us to update Zephyr to a newer version and tackle the
SMP boot and cache interface changes in SOF. The latest Zephyr upstream
has further changes needed in SOF for platform configuration and these
will require separarate changes.

Link: https://github.com/thesofproject/sof/issues/8818
Link: https://github.com/zephyrproject-rtos/zephyr/issues/69807
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-06 11:13:57 +02:00
Laurentiu Mihalcea 5ec60b341b app: boards: mimx93_evk_a55: change SRAM0's address to 0xd000000
Zephyr commit b985442829dd ("dts: mimx93_evk_a55: avoid conflict
with Ethos-U NPU reserved memory") changes SRAM0's address to
0xd0000000. This breaks the i.MX93 SOF build because the SRAM0
node is no longer deleted so west build complains about having
2 SRAM0 nodes with different addresses.

To fix this, update the deleted node's base address.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-06 11:13:57 +02:00
Guennadi Liakhovetski d8d93d3af7 cache: switch over to the new Zephyr cache API
z_soc_uncached_ptr() / z_soc_cached_ptr() have been removed from
Zephyr and replaced with sys_cache_uncached_ptr_get() and
sys_cache_cached_ptr_get() respectively.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-06 11:13:57 +02:00
Daniel Leung 5f1e6900d9 zephyr: use k_smp_cpu_start/_resume for secondary core power up
This changes the secondary core power up routine to use the newly
introduced k_smp_cpu_start() and k_smp_cpu_resume(). This removes
the need to mirror part of the SMP start up code from Zephyr, and
no longer need to call into Zephyr private kernel code.

West update includes :

eefaeee061c8 kernel: smp: introduce k_smp_cpu_resume
042cb6ac4e00 soc: intel_adsp: enable DfTTS-based time stamping
             on ACE platforms
6a0b1da158a4 soc: intel_adsp: call framework callback function for restore
e7217925c93e ace: use a 'switch' statement in pm_state_set()
c99a604bbf2c ace: remove superfluous variable initialisation
a0ac2faf9bde intel_adsp: ace: enable power domain
4204ca9bcb3f ace: fix DSP panic during startup  (fixes c3a6274bf5e4)
d4b0273ab0c4 cmake: sparse.template: add COMMAND_ERROR_IS_FATAL
ca12fd13c6d3 xtensa: intel_adsp: fix a cache handling error
0ee1e28a2f5f xtensa: polish doxygen and add to missing doc
035c8d8ceb4b xtensa: remove sys_define_gpr_with_alias()
a64eec6aaeec xtensa: remove XTENSA_ERR_NORET

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
[guennadi.liakhovetski@linux.intel.com: update Zephyr hversion]
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-06 11:13:57 +02:00
Yong Zhi 6ec15f6d88 audio: google: use system directories for mock header include
No function change, builds fine.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2024-03-06 10:13:45 +02:00
Seppo Ingalsuo 259c923a23 Tools: Topology2: No need for HDA platform variants for benchmark tplg
Since there is no NHLT blob included to these topologies, the same
topology works for all HDA platforms, e.g. TGL, MTL, LNL.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-03-05 16:03:44 +02:00
Marc Herbert 4f59ee80b4 ipc-helper.c: reject invalid SOF_MEM_CAPS_* bits
Fixes lack of SOF_MEM_CAPS_* input validation found in #8832

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-05 13:09:35 +02:00
Jakub Dabek dc8b367dcd vmh_tests: Add set of parametrized tests and test suit
Add enhanced vmh testing.
Add tests for: heap creation, heap creation with config, multiple
allocation tests for each heap mode.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-03-05 11:11:20 +01:00
Jakub Dabek fe92f03c59 vmh_tests: remove current vmh test implementation
Remove current tests for vmh api. To be replaced by
new implementation.
Old implementation is not parametrized and only checks one scenario:
create heap and allocate on it.
New implementation will cover multiple heap creation, multiple allocations,
checking allocated memory for physical page allocation among other
scenarios.
Remove whole implementation since there is no code reuse.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-03-05 11:11:20 +01:00
Jakub Dabek f5a11dc454 boot_test: change call of boot tests
Boot tests were dependent on ipc. Change to run theme as part of
zephyr boot process.
Calls to zephyr api were deprecated and would not build with current
zephyr version. Update the call.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-03-05 11:11:20 +01:00
Marc Herbert 60f517cd09 config L3_HEAP: add missing "ACE" dependency
In Zephyr, L3_HEAP is available in `intel_ace15_mtpm/adsp_memory.h` and
`intel_ace20_lnl/adsp_memory.h` but not in `intel_tgl_adsp/adsp_memory.h`

Don't allow configuration that can't possible compile.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-05 11:49:39 +02:00
Kai Vehmanen a90435734e versions.json: set version to 2.9.99
Open tree for 2.10 development now that stable-v2.9 is branched out.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-03-04 18:21:58 +02:00
Tomasz Leman fe690316e1 zephyr: pm_runtime: Remove outdated TODO comment
Clean up an incorrect TODO comment in the power management runtime
policy.

The removed comment suggested the need for substates to handle cases where
power gating (PG) is enabled and clock gating (CG) is disabled. However,
this is not accurate because:
- Enabling PG when CG is not allowed is not feasible; entering PG could
  inadvertently gate the clock even if CG prevent is active.
- Substates are no longer required as clock gating is now always enabled.

This change clarifies the power management behavior and removes confusion
around the handling of power and clock gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-03-04 14:13:00 +02:00
Adrian Bonislawski dc80db7bd5 app: perf_overlay: disable CONFIG_ADSP_IDLE_CLOCK_GATING
Perf build uses xtensa timer

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2024-03-04 12:06:00 +02:00
Marc Herbert ea1b65dae4 sof_ri_info: fix "full_bytes" comment in the source
Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-04 12:04:28 +02:00
Marc Herbert 2d405d70a7 sof_ri_info: add MTL production key
Extracted from v2.8 v2.8.x/sof-ipc4-v2.8/mtl/intel-signed/sof-mtl.ri

Verified on v2.8.1 https://github.com/thesofproject/sof-bin/pull/162

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-04 12:04:28 +02:00
Guennadi Liakhovetski 44376d86db module: (cosmetic) use an existing local variable
modules_init() already has a "dev" variable, no need to re-calculate
it repeatedly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-03-01 16:50:13 +00:00
Marc Herbert 1b0c084fb9 xtensa-build-zephyr.py: clarify XTENSA_SYSTEM and XTENSA_CORE in --help
This has always been mysterious, try to shed a bit of light.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-01 16:45:59 +00:00
Marc Herbert a90ed21be3 xtensa-build-zephyr.py: use a triple-quoted string for the help epilog
Pure formatting simplification, zero logical change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-01 16:45:59 +00:00
Marc Herbert eeb0f2ab36 xtensa-build-zephyr.py: simplify and clarify Cadence env vars
Remove unnecessary complexities in the Python code.

Document all variables in the comments.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-01 16:45:59 +00:00
Marc Herbert cb4c3ee74d xtensa-build-zephyr.py: fix message when XTENSA_TOOLS_ROOT is wrong
Like most error handling, the exception was never tested and the error
message was wrong.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-03-01 16:45:59 +00:00
Marc Herbert dfc59bc3c1 .github/ipc_fuzzer.yml: save crash-* and fuzz-*.log artifacts
"Unit test" crash-* files allow instant reproduction.

fuzz-*.log files are created when using -j

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-02-29 13:26:02 +00:00
Marc Herbert ac934fee56 .github/fuzzer: use new -j $(nproc) option
Use new option to fuzz more in the same time.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-02-29 13:26:02 +00:00
Marc Herbert 582c81fab8 fuzz.sh: add -jobs parameter. Switch to built-in -max_total_time.
There was no need to use the external "timeout" command + some
complicated exit code logic, libFuzzer has that feature built-in. Switch
to it and delete a few good line.

Add an option to use the built-in, concurrent -jobs feature which saves
a massive amount of time. It has some quirks so do not enable it by
default.

Decrease verbosity by default.

Add in the help message the magic replay command that saves a ton of time.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-02-29 13:26:02 +00:00
Jakub Dabek 520ef18f6c vmh: fix allocation size value calculation
Allocation sizes were calculated with faulty logic. Bits to check
size calculation is not needed since array position was calculated
and loop should go from this position to array end.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-02-29 10:08:10 +01:00
Jakub Dabek 4189f09b69 vmh: fix array update for contiguous allocation
Array holding sizes of allocations was not updated correctly this
fixes array update issue.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-02-29 10:08:10 +01:00
Jakub Dabek f8d5ffb843 vmh: fix same size block allocation
When allocating non contiguously if exact block size was allocated on
given physical allocator it would fail. Fix logic to include
that event.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-02-29 10:08:10 +01:00
Jakub Dabek f23827a203 vmh: fix allocation size check
When using non contiguous allocation block size is calculated after
the check.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-02-29 10:08:10 +01:00
Marc Herbert 0fee9d9630 scripts/fuzz.sh: add a couple debug -DCONFIG_ options
They shouldn't do much but they can't hurt.

See https://github.com/thesofproject/sof/pull/8632 for more details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-02-28 15:39:56 +00:00
Marc Herbert 884305b837 zephyr/wrapper.c: dereference NULL in POSIX for better k_panic() trace
As discussed in the alternative approach
https://github.com/zephyrproject-rtos/zephyr/pull/68494/, k_panic() in
POSIX mode has various shortcomings that do not provide a useful
trace. Useless pointers to signal handlers or other cleanup routines are
printed instead. Leverage our already existing
k_sys_fatal_error_handler() and dereference a NULL pointer there when in
POSIX mode. This "fails fast" and provides a complete and relevant stack
trace in CI when fuzzing or when using some other static
analyzer. Example of how fuzzing failure #8832 would have looked like in
CI results thanks to this commit:

```
./build-fuzz/zephyr/zephyr.exe: Running 1 inputs 1 time(s) each.
Running: ./rballoc_align_fuzz_crash
*** Booting Zephyr OS build zephyr-v3.5.0-3971-ge07de4e0a167 ***
[00:00:00.000,000] <inf> main: SOF on native_posix
[00:00:00.000,000] <inf> main: SOF initialized
@ WEST_TOPDIR/sof/zephyr/lib/alloc.c:391
[00:00:00.000,000] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic
[00:00:00.000,000] <err> os: Current thread: 0x891f8a0 (unknown)
[00:00:00.000,000] <err> zephyr: Halting emulation
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1784402==ERROR: AddressSanitizer: SEGV on unknown address 0x00000000
==1784402==The signal is caused by a WRITE memory access.
==1784402==Hint: address points to the zero page.
    #0 0x829a77d in k_sys_fatal_error_handler zephyr/wrapper.c:352:19
    #1 0x829b8c0 in rballoc_align zephyr/lib/alloc.c:391:3
    #2 0x8281438 in buffer_alloc src/audio/buffer.c:58:16
    #3 0x826a60a in buffer_new src/ipc/ipc-helper.c:48:11
    #4 0x8262107 in ipc_buffer_new src/ipc/ipc3/helper.c:459:11
    #5 0x825944d in ipc_glb_tplg_buffer_new src/ipc/ipc3/handler.c:1305:8
    #6 0x8257036 in ipc_cmd src/ipc/ipc3/handler.c:1651:9
    #7 0x8272e59 in ipc_platform_do_cmd src/platform/posix/ipc.c:162:2
    #8 0x826a2ac in ipc_do_cmd src/ipc/ipc-common.c:328:9
    #9 0x829b0ab in task_run zephyr/include/rtos/task.h:94:9
    #10 0x829abd8 in edf_work_handler zephyr/edf_schedule.c:32:16
    #11 0x83560f7 in work_queue_main zephyr/kernel/work.c:688:3
    #12 0x82244c2 in z_thread_entry zephyr/lib/os/thread_entry.c:48:2
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-02-28 15:39:56 +00:00