Commit Graph

90 Commits

Author SHA1 Message Date
Serhiy Katsyuba e6e441ced5 ipc4: add IPC4 gateway
Adds IPC4 gateway. IPC4 gateway transfers audio between host
and DSP without DMA: via memory window (audio payload) and IPC4
messages (commands).

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-02-07 16:27:20 +00:00
Adrian Warecki d33af9ffbd platform: ace: watchdog: Add ll watchdog support
This commit adds watchdog support in zephyrs ll domain for ace platform.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-01 12:43:29 +02:00
Piotr Makaruk d92f07ad30 hda: chain management and logic implementation
Hardware HDA chain require manager for controlling multiple streams tasks.
Enable support with LL task and DMA mandatory logic.

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-01-19 15:37:32 +01:00
Jakub Dabek 99093bac4e memory: Add virtual memory regions gathering and structs
Add virtual memory regions info gathering from zephyr and introduce
structs agregating this information.
Add proper defines for memory management.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2023-01-17 16:10:44 +02:00
Krzysztof Frydryk 6b647412bf lib: Add mcps budget manager for cpu clock control
Initial implementation of MCPS budget manager.
FW can request/free MCPS usage on enabling certain FW elements. Caution
should be taken when processing on different cores, as kcps_budget_data
is uncache only. The manager will change clock source to match requested
MCPS consumption. Budget manager may interfere with manually setting
clock values!

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2023-01-09 15:12:13 +00:00
Andy Ross c50eddce1f platform: Add Zephyr native_posix-based emulation environment
This extends the ideas in CONFIG_LIBRARY=y to implement SOF as an
application for the Zephyr native_posix architecture.  These are host
x86 or x86_64 binaries that include a full OS build, which can be used
(via mocked drivers) for testing against host validation environments
like ASAN/MSAN.

The mechanism uses the existing "host" architecture used by
CONFIG_LIBRARY, but adds a new platform layer named "posix", populated
entirely with stubs.

No driver integration is provided in this patch.  The resulting
executable builds correctly, but has no devices and won't do anything.

Signed-off-by: Andy Ross <andyross@google.com>
2022-12-07 17:25:39 +00:00
Marc Herbert 5311f61037 zephyr/cmake: fix target_compile_options() comments. No code change
Add reference to -fno-inline-functions issue
https://github.com/thesofproject/sof/issues/5212

Add examples of compilation failures without gnu99.

Fixes commit e430629a1e ("xt-clang: Do not use -std=gnu99 for C++")
that separated the comment from its code.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-11-30 11:50:28 +00:00
Andrula Song 7f36f83333 Audio: Mixin_mixout: Optimize the mixin processing functions
Use audio_stream_samples_without_wrap_sx to replace the complicated
boundary detection for every sample and separate the mix functions to
normal mode and remap mode.

Normal mode (the default mode) can save at least 55.5% cycles for C
version and at least 76.7% for HiFi3 version.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-11-25 11:58:18 +00:00
Jaroslaw Stelter e430629a1e xt-clang: Do not use -std=gnu99 for C++
Option -std=gnu99 applied to C++ files trigerrs warning for xcc
compiler however throws error for xt-clang.
This patch limits usage of this flag to C, ASM code only.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-11-22 16:03:31 +00:00
Marcin Szkudlinski 315962c4d7 zephyr: move memory allocation code 1:1 from wrapper.c to alloc.c
to have more order in the code - move memory code from a huge
common wrapper.c to specific lib/alloc.c
Note there is NO changes in the code, code is as it was before

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-11-21 17:09:52 +00:00
Daniel Baluta 25493e5d44 zephyr: Add zephyr lib.c standalone file
We need this in order to export symbols to external libraries.

E.g Cadence library needs __vec_memset / __vec_memcpy.

Previous commit d9aed376d5 ("zephyr: rtos: Add __vec_memcpy /
__vec_memset") is not enough in the case of external libs.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-11-11 15:57:50 +02:00
Laurentiu Mihalcea 1daedbf646 Introduce Zephyr DMA domain as experimental feature
This series of changes allows developers to enable DMA
domain on Zephyr. Currently, this feature is marked as
experimental because it still requires a lot of testing
and bug fixes.

In the case of i.MX, these changes still allow the usage
of dma_multi_chan_domain in conjunction with ll_schedule
if so desired. This is done because the feature is still
experimental and once it becomes more stable the appropriate
changes will be done in order to make DMA domain the
default option.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-11-02 12:34:34 +00:00
Andrula Song 87bd3d628b Math: IIR: add Direct-1 format implementation of IIR
Add C and hifi3 version Direct-1 implementation for IIR,
and rename the structure of sof_eq_iir_header_df2t to
sof_eq_iir_header for both two format sharing. Compared
with the original Direct-2 transport format,Direct-1 has
better performance on low frequency since lower quantization
noise while asking the same memory. The C version cost the
same cycles and hifi version can save about 9.8% cycles than
Direct-2 transport format.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-10-28 12:33:56 +01:00
Tomasz Leman e973f5245e zephyr: cpu: moving outside of the wrapper
Moving core management code out of the wrapper for solutions builded
with zephyr.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-10-26 13:27:25 +01:00
Adrian Warecki ac33ac128b ace: dma: Add dma configuration
Added code containing configuration of the dma channels.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-10-18 16:10:37 +03:00
Adrian Warecki c47a0bf6ff ace: clock: Update clock definitions
Added code with clock definitions

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-10-18 16:10:37 +03:00
Jaska Uimonen 251ee59b2e ipc: rename ace ipc zephyr stubb as ipc-zephyr.c
Rename ace ipc zephyr stubb as ipc-zephyr.c as it is a generic interface
towards zephyr cavs/ace ipc drivers. Change existing zephyr ace/mtl
makefile reference to it and start using it in cavs/tgl ipc4 zephyr
native drivers builds. Tgl ipc3 builds will still use sof cavs ipc
driver.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2022-10-17 17:01:09 +03:00
Adrian Warecki 784bce763c mtl: Added meteorlake platform to the build system
Added new mtl platform to xtensa-build-zephyr.py.
Added ace directories to cmake files.
Added ACE to kconfig.
Add Meteorlake platform to be built with Zephyr under
CONFIG_ACE_VERSION_1_5 flag.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-21 15:15:26 +02:00
Anas Nashif ddc104c66d zephyr: both BDW and BYT are not supported in zephyr
Both Broadwell and Baytrail are not supported in zephyr and those
Kconfigs are not defined anywhere, neither in SOF nor in zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-09-16 15:32:25 +01:00
Jaroslaw Stelter de889c554b library_manager: module_adapter: Enable build of library manager and IADK modules
Add the library manager and IADK modules to build.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-09-07 18:05:11 +01:00
Daniel Baluta 0488ffee32 zephyr: Fix DRC module compilation
Add DRC files to Zephyr compilation to avoid failures like this:

sof/src/audio/drc/drc_generic.c:188: undefined reference to
`drc_lin2db_fixed'

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-09-06 21:40:06 +01:00
Liam Girdwood c3c94fc515 header: rtos: use rtos specific version of wait.h
Code can now include <rtos/wait.h> and uses native Zephyr 64
cycle API instead of SOF version.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-06 15:37:21 +01:00
Liam Girdwood c90055f2f5 header: rtos: use rtos specific version of string.h
No runtime semantic change. Use C library when RTOS uses
C library otherwise use own C library calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood ce0879a432 header: rtos: use rtos specific version of atomic.h
No runtime functional change. Code can now include <rtos/atomic.h>

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood 1629a1f72c header: rtos: decouple headers into rtos specific directories.
No functional runtime change, but changes to rtos partitioning and the
layout of headers .

This patch creates RTOS specifc header paths and updates spinlock.h
and kernel.h to show the new usage. Other headers will incrementally follow.
It reuses the current zephyr topleve directory and creates a new
toplevel xtos directory for xtos specific files.

Due to the mixing of RTOS, driver and library headers at the top level include
directory it was necessary to create rtos specific header directories i.e.

src/include/rtos-xtos
src/include/rtos-zephyr

These RTOS include directories will eventually contain RTOS specific headers
whilst common logic and structures will be placed in non RTOS directories.

This will also mean

"#include <sof/spinlock.h>"

will become

"#include <rtos/spinlock.h>"

and will allow easier visualisation of where and why RTOS headers are being used.
This will help to eliminate cross usage of headers between RTOSes.

Subsequqnt patches will move more headers and rtos specific wrppaer
source files into rtos specific locations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Kai Vehmanen 8a8845e5ff ipc4: implement mtrace logging support
Handle IPC4_ENABLE_LOGS basefw message. If firmware is built with
Zephyr and CONFIG_LOG_BACKEND_ADSP_MTRACE is defined, initialize
the mtrace logging backend.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +01:00
Andrula Song 100144a1d0 Audio: Mixer: Add hifi version processing functions for mixer
Add hifi3 & hifi4 version implementation of mixer processing functions.
The hifi version functions can save at least 47% cycles than C version.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-08-24 12:00:30 +01:00
Kai Vehmanen c3d1228fb0 probe: add backend for logging via probes
Implement a Zephyr logging backend which routes the logs via SOF
probes interface.

Tested with Linux SOF driver, crecord and sof/tools/probes for decoding.

The patch modifies the probes IPC3 interface, adding a new probe purpose
field (PROBE_PURPOSE_LOGGING, 0x3) to specify probe extraction for
logging. A field for system trace (as is also reserved (PROBE_PURPOSE_TRACING).

Example usage in Linux:

 term1# crecord -c3 -d0 -b8192 -f4 -FS32_LE -R48000 -C4 /tmp/extract.dat
 term2# echo 0,3,0 > /sys/kernel/debug/sof/probe_points
 term1# <terminate crecord>
 term1# sof-probes -p /tmp/extract.dat
 term1# cat buffer_0.bin

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-16 15:36:42 +01:00
Krzysztof Frydryk a6e936359c src: enable hifi4 optimized src build with zephyr
Add src_hifi4.c to sources when building with zephyr.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-07-27 23:08:16 +01:00
Andrula Song 12d660b088 Audio: copier: add hifi version implementation of apply_attenuation
add hifi version implementation of apply_attenuation, using xtensa
instructions can save about 74% cycles than the original one.

Signed-off-by: Andrula Song <xiaoyuan.song@intel.com>
2022-07-15 08:55:11 +01:00
Serhiy Katsyuba 9d2857fe37 mixin/mixout all topologies support
Adds possibility to connect single mixin to multiple
mixouts. This allows for all possible mixin/mixout
topologies.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-07-13 09:47:09 +01:00
Guennadi Liakhovetski 162dafc288 zephyr: add third-party components
Add multiple third-party and optional audio processing components to
the Zephyr cmake and initialisation lists.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-07-01 11:11:23 +01:00
Jaska Uimonen 015ec63c4d zephyr: add glue code to use zephyr dai drivers
This patch adds a mechanism to load and use dai driver from zephyr
instead of xtos driver.

Patch includes following changes:
- dai-zephyr.c calls directly zephyr driver methods
- include/lib/dai.h is divided into dai-legacy.h and dai-zephyr.h
- use zephyr dais by configuring CONFIG_ZEPHYR_NATIVE_DRIVERS=y

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-06-16 20:15:59 +01:00
Liam Girdwood e327f09250 ipc: blob: Add a Kconfig option for the blob loader
Save memory when not used.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-06-10 20:27:31 +01:00
Ranjani Sridharan f7663de1f4 volume: use the new module interface
Move the volume component inside the module_adapter folder and use the
module interface API instead of the component driver interface. Also fix
the volume cmocka tests to use the modified scale_vol function.

Also, add kconfig option for keeping the legacy comp_drv interface for platforms
that are limited in text region memory size, such as
BYT/CHT/APL/JSL/ICL.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-06-10 09:50:08 +01:00
Adrian Bonislawski 2b7fdc95de dma: add Zephyr native DMA support to host & dai
This patch will add new versions of host and dai components
with Zephyr native DMA support

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-05-31 15:28:27 +01:00
Daniel Baluta 2e3823ac34 zephyr: Fix compile error after switching to module_adapter naming
There are few left paths and config names after switching from
codec_adapter to module_adapter.

Without this building codec modules fails

Fixes: b4591ca8f4 ("codec_adapter: rename it to module_adapter and fix all includes")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-05-12 09:50:04 +01:00
Kai Vehmanen 9c9ad34464 zephyr: move Zephyr IDC implementation to zephyr_idc.c
SOF uses IDC (Intra DSP Communication) protocol to orchestrate
work across multiple DSP cores.

The interface in sof/drivers/idc.h defines the protocol and
also provides a high-level interface for drivers. On Zephyr,
the SOF IDC protocol is used, but the actual communication
is implemented on top of Zephyr P4WQ workqueue interface,
instead of directly calling into drivers.

Move the Zephyr implementation from src/schedule/ into
src/idc/ which is more suitable place for this code.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-05-06 10:21:00 +01:00
Jyri Sarha b81c76f854 component: Split data_blob.[ch] out of component.[ch]
The data blob handler functionality is quite independent from the rest
of the generic component code. The component.c and component.h are
already too big so it is better to split the data blob handler
functionality out before adding more features to it.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-04-05 17:47:18 +01:00
Daniel Baluta b18f08d095 zephyr/cmake: Add support for linking with cadence libs
We add support for linking with Cadence AAC/MP3 libs.

Cadence lib MP3 support is enabled via CONFIG_CADENCE_CODEC_MP3_DEC config
symbol. Path to library file needs to be set via CONFIG_CADENCE_CODEC_MP3_DEC_LIB

Similar for AAC.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-03-10 09:57:11 +02:00
Marc Herbert f052cbffaa zephyr/cmake: fix SOF_ROOT_SOURCE_DIR to fix the .ldc checksum
Fixes copy/paste of commit de41202f8f ("zephyr: build: Add initial
build support for SOF application.")

This fixes the dictionary hash when using Zephyr; no more fallback on
the git SHA1.

When using Zephyr, SOF_ROOT_SOURCE_DIR (and SOF_ROOT_BINARY_DIR) are used
only by version.cmake

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Daniel Baluta b06f2cfe23 zephyr: add codec adapter components
This enables codec_adapter and cadence/passhtrough codecs
with SOF on Zephyr.

passthrough codec can be used as it is, but cadence codec
will also need codec libraries from cadence.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-02-18 21:12:24 +00:00
Guennadi Liakhovetski d0057a7def Revert "zephyr: add a generic Zephyr platform"
This reverts commits e0ff1b16d8,
339e5ac217 and
09c69b7607. A different approach will
be used for making SOF a platform-agnostic Zephyr application.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-02-11 11:18:54 +00:00
Chao Song 487363fb1b zephyr: add copier and base_fw components
The two components copier and base_fw are
essential to IPC4 support on SOF on Zephyr.

This patch integrates the build of the two
components to SOF build with zephyr RTOS.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-11 11:02:19 +00:00
Seppo Ingalsuo beb0610148 Math: IIR: Move IIR DF2T initialize helpers to library
The DF2T IIR core has been moved earlier to library but the
helper functions for configuring it were left to EQ component.
This patch eases use of IIR core from other components. The
file src/audio/eq_iir/iir.c is moved to src/math. There are no
changes except of remove iir.h since the contents specific
for DF2T type were merged to iir_df2t.h

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-02-04 10:02:55 +00:00
Marc Herbert 361fbf4504 zephyr/cmake: remove obsolete cmake 3.12 version test
Zephyr requires CMake 3.21 and SOF requires 3.13, see
commit a0acad3414 ("CMake: require version 3.13")

Fixes commit 4b2edf8eed ("zephyr: wrapper: complete zephyr support for
working audio")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-26 10:14:15 -08:00
Guennadi Liakhovetski 92f6db8ba9 zephyr: add support for IPC4
Select correct IPC implementation depending on the selected version.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-21 17:05:58 +00:00
Marc Herbert 12f4834e40 zephyr: move GENERATED_DIRECTORY from source tree to build directory
This makes it possible to clean sof_versions.h.

Also remove DOT_CONFIG_PATH copy/paste which is unused in
Zephyr.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:56:29 +00:00
Marc Herbert deb0e7340e Rename generated version.h to sof_versions.h
Zephyr also a version.h too so the situation was a buggy #include mess
that (among others) dropped the SOF git version from the SOF banner when
using Zephyr. It's absolutely impossible to fix this mess while keeping
two .h files both named exactly the same and even included with the
exact same '#include version.h' line, I mean no sof/version.h or other
prefix.

As a bonus, this rename also reduces the XTOS-only confusion between
"version.h" and cavs/version.h".

Generating a file in the source tree is a serious bug (to be fixed
later), it means this file is never cleaned. Do not hide this bug with a
.gitignore rule.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:56:29 +00:00
Guennadi Liakhovetski e0ff1b16d8 zephyr: add a generic Zephyr platform
When built with Zephyr, SOF ideally should be a fully platform-
agnostic application. All platform-specific code should reside in
Zephyr itself, including core architecture and platform
infrastructures and drivers. To prepare for this transition we add a
generic SOF-Zephyr platform. It is based on the current Tiger Lake
architecture and should be usable for cAVS 2.5 and newer systems.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-12-31 08:06:24 +00:00