Commit Graph

11837 Commits

Author SHA1 Message Date
Andrula Song 40c8e477f0 Audio: Component: Fix the potential risks of HiFi3 audio_stream_copy
Use while (shorts > 0) instead of while (short) to reduce the forever
loop risk.

Use general instruction AE_MIN32 replace AE_MIN_32_signed which is an
internal proto intended for Xtensa compiler.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 17:01:03 +02:00
Andrula Song 50c8aeb710 Audio: Component: Add HiFi5 implementation of audio_stream_copy
Add HiFi5 implementation if function audio_stream_copy, compared
with HiFi3 version, the HiFi5 method can save about 29% cycles.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2024-03-08 17:01:03 +02:00
Laurentiu Mihalcea 1f87ffcea0 ipc3: dai: change channel decoding function for native SAI and ESAI
The native SAI and ESAI drivers use a different handshake
encoding. As such, when using native Zephyr drivers use a
different function for decoding the channel from the handshake.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea ef06790b94 audio: dai-zephyr: add function for computing DMA slot
In the case of some DAIs, the DMA slot may be encoded
differently in the DAI configuration handshake. As such,
we can't count on the fact that the handshake itself can
be used as the DMA slot. To fix this, add a function which
parses the handshake and allows each DAI to use its own
encoding of the DMA slot inside the handshake.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
Laurentiu Mihalcea 76c0595938 audio: dai-zephyr: Add state change on DAI trigger
Currently, the DAI component's state is not updated on
dai_trigger() operation, which leads to pipeline_comp_copy()
skipping the dai_copy() operation (since the DAI component
never transitions to the ACTIVE state). To fix this, add
a state transition in dai_comp_trigger_internal(). Also,
make sure not to trigger the DAI component if already in
the requested state.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-03-08 14:33:37 +00:00
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