Commit Graph

157 Commits

Author SHA1 Message Date
Marc Herbert 125d372b19 docker-build.sh: don't switch versions when already initialized
Restore ability to use (and test!) zephyr/docker-build.sh locally
without overwriting work in progress.

Fixes commit b371373f7d ("scripts: docker-build.sh updated with
changes from xtensa-build-zephyr.py")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-04 09:46:22 +01:00
Guennadi Liakhovetski e135633636 zephyr: update for recent Zephyr include path changes
Zephyr removed support for header inclusion without the zephyr/ path.
Update SOF with correct paths.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-03 20:59:53 +01:00
Andrey Borisovich b371373f7d scripts: docker-build.sh updated with changes from xtensa-build-zephyr.py
Removed old flags from python script call and replaced with
new one. Added one more working directory to zephyr-build container
now SOF is placed in /workdir/sof and west workspace in /workdir .

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-08-03 11:43:22 +01:00
Daniel Baluta 1c018d517f timer: Introduce sof_cycle_get_64
With Zephyr, SOF uses k_cycle_get_64() API in order to
count clock cycles.

Not all platforms have a 64bit counter (e.g i.MX dsp integration
only has xtensa timer which is limited to 32 bits).

So, instead of using k_cycle_get_64 introduce new API sof_cycle_get_64
which keeps the existing behavior for platforms which define
CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER, otherwise use k_uptime_ticks().

See comments from @andyross at
https://github.com/zephyrproject-rtos/zephyr/pull/48318

Suggested-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-08-01 11:09:39 +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
Ranjani Sridharan 4af7082ad0 Revert "eq_iir: Use the new module interface"
This reverts commit 9d9ba739b3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-07-19 15:33:29 -05:00
Ranjani Sridharan 9d9ba739b3 eq_iir: Use the new module interface
Use the module interface instead of the comp drv interface for the
EQ IIR component.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-07-18 16:56:40 +01:00
Anas Nashif a0c9907dbd zephyr: module: point to where the app is
This allows building SOF from zephyr for CI and testing purposes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-18 14:22:01 +01:00
Anas Nashif 33112b74e8 zephyr: use zephyr prefix for includes
Zephyr includes are now under a zephyr namespace, so use this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-18 14:22:01 +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
Guennadi Liakhovetski 8397711d64 heap: heap_alloc_aligned_cached() returns a cached address
heap_alloc_aligned_cached() is a helper function used to allocate
memory with a cached alias. Therefore its returned pointer should
use the __sparse_cache annotation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-05-11 14:30:11 +01:00
Marc Herbert 3f86cab70f zephyr/docker-build.sh: make failure to symlink the SDK not fatal
When running interactively the symlink may already be there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-05-08 10:01:57 +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
Ranjani Sridharan d779624a9b codec_adapter: rename DECLARE_CODEC_ADAPTER and comp_driver
to DECLARE_MODULE_ADAPTER and comp_driver to comp_module_adapter.
Also rename SOF_COMP_MODULE_ADAPTER to SOF_COM_MODULE_ADAPTER.
No functional changes.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-05-04 16:01:23 +01:00
Chao Song f4f9e6541e sof: replace log calls with zephyr logging api
The log context in zephyr is per file or module.

To use zephyr logging api, LOG_MODULE_REGISTER is used
to register a log context, LOG_MODULE_DECLARE is used
to refer to the registered context.

For function in header file, LOG_MODULE_DECLARE should
be used within that function to avoid context collapse,
a condition one source file have multiple context
registered or declared.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-04-27 15:05:24 +01:00
Marc Herbert d09844ab98 zephyr/docker-build.sh: match UID with 'adduser' instead of 'chgrp -R'
This fixes SOF version.cmake which was just broken by a recent git
security update and started to fail like this:

```
  -- SOF version.cmake starting at 2022-04-25T18:14:56Z UTC
  -- /workdir/zephyr/.. is at git commit with parent(s):
  fatal: unsafe repository ('/workdir' is owned by someone else)
  To add an exception for this directory, call:

   git config --global --add safe.directory /workdir
```
(example at https://github.com/thesofproject/sof/runs/6162885265)

chgrp -R was always an ugly hack because it was messing with
(persistent) file permissions on the host, outside the container. This
new adduser solution is unfortunately much more code but it does not
leak any side effect outside the container.

Do not fix scripts/docker-run.sh yet because there is still no UID
mismatch between Github Actions and the SOF container (they're both
1001) but add a warning + TODO.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-26 22:08:53 +01:00
Kai Vehmanen 020c9f3fa5 zephyr: track SOF app calls to enable/disable cores separately
Add a static variable w_core_enable_mask in Zephyr wrapper.c to
track requests to enable and disable cores, and use this to
implement arch_cpu_enabled_cores().

We don't yet have a implementation to power off secondary cores.
This creates issues to SOF application code that may rely on
disabling of cores to be reflected in cpu_enabled_cores(). Instead
of adding ifdefs in application code, manage this within wrapper.c.
Once the secondary core power-off is implemented, this static
variable can be removed.

BugLink: https://github.com/thesofproject/sof/issues/5701
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-25 16:24:39 +01:00
Adrian Warecki cc24c9cf77 zephyr: wrapper: rballoc_align: Support for the SOF_MEM_FLAG_COHERENT flag
The function rballoc_align did not take into account the passed flags, so
it always incorrectly allocated a cached memory. Added support for the
SOF_MEM_FLAG_COHERENT flag.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-04-19 16:51:49 +01:00
Ederson de Souza 9e18603636 zephyr: Use type compatible with Zephyr linker declarations
`_end` and `_heap_sentry` linker symbols are used to infer heap size. In
Zephyr, `_end` is referenced as `char []` while in SOF as `uint8_t`.
This may "conflicting types", should those declarations be built
together.

This patch changes the Zephyr wrapper to also use `char []`, thus
avoiding this issue.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-04-13 16:45:34 +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
Guennadi Liakhovetski e1ca6f6252 dw-dma: allocate uncached memory for LLI always
Multi-core configurations already use uncached memory for LLI. This
also makes sense to avoid having to manually synchronise cache. Force
LLI objects uncached.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-03-21 15:35:54 +00:00
Adrian Warecki c1e75603b2 timer: Use Zephyr timer API
Replaced sof timer related functions with Zephyr alternative.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-03-16 12:02:29 +00: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
Rander Wang 0b537cba4d ipc4: init gain & mixin components for zephyr
Fix issue of ipc4 pipeline initialization with zephyr enabled.
Need to initialize these two components. Gain module is another
type of volume without peak volume support and mixin has subset
function of mixer.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-01 22:50:17 +00:00
Kai Vehmanen f1e3c934f0 zephyr: use z_init_cpu() if Zephyr 3.0.99 or newer
Use the new interface to initialize non-primary cores before
enabling them with arch_start_cpu(). This interface is not
available in Zephyr 3.0.0, but is mandatory in later release.

Depends on Zephyr commit 2b210cb3db05 ("kernel: Refactor SMP cpu
initialization a bit").

BugLink: https://github.com/thesofproject/sof/issues/5456
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Kai Vehmanen 760f5ddea2 zephyr: fix race in secondary core power-up
z_wrapper_cpu_enable_secondary_core() may be called
repeatedly on a core that is already running. Add a check
to ensure we do not try to restart a core that is already
running.

Also add a check for ready_flag as done in upstream Zephyr
kernel/smp.c to ensure z_wrapper_cpu_enable_secondary_core()
does not return until the target core has finished its
startup and arch_cpu_active() returns true.

BugLink: https://github.com/thesofproject/sof/issues/5446
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:47:01 +00:00
Marc Herbert e2db3bcdb9 .github: switch to new xtensa-build-zephyr.py
Switch Github Actions away from older shell script.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-24 14:54:50 +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
Marc Herbert 425a200113 zephyr: replace obsolete README section with link to sof-docs
Replaced with
https://thesofproject.github.io/latest/getting_started/build-guide/build-with-zephyr.html

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-07 10:43:28 +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
Kai Vehmanen 6363a86309 zephyr: add missing call to smp_timer_init to secondary core init
To align with Zephyr smp.c:smp_init_top(), add the missing call to
smp_timer_init() in secondary_init() of the SOF wrapper. Also
add inline documentation why we are open-coding the function on
SOF side.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-04 09:33:56 +00:00
Kai Vehmanen 10f4669ccc Revert "zephyr: implement arch_cpu_disable_core()"
This reverts commit 414089aa44.

Failures hit with 4core cAVS2.5 configuraions, so this has
to be reverted. We need an implementation that keeps both
Zephyr (and SOF runtime-DSP if still used) in the loop.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-02 15:48:30 +00:00
Kai Vehmanen 378d7b7822 zephyr: always use Zephyr interface to power up secondary cores
Currently there is code to power up secondary cores both
in Zephyr architecture hooks in wrapper.c, as well as in
SOF runtime-PM driver.

Some of this is necessary overlap until full replacement of
SOF runtime-PM is available. But for secondary core power up,
we can already clean up the flow and hook the Zephyr core
enable code to runtime-PM driver directly. This fixes startup
issues seen on Intel cAvS2.5 platforms.

Core power-down is left intentionally for runtime-PM driver
to handle as the related interface in Zephyr is not ready
for use yet.

BugLink: https://github.com/thesofproject/sof/issues/5018
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-02 10:40:42 +00:00
Kai Vehmanen 414089aa44 zephyr: implement arch_cpu_disable_core()
Add implementation of secondary core disable with a call
to SOF runtime-PM framework.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-02-01 15:25:48 +00:00
Marc Herbert f30892d966 Revert "zephyr: (cosmetic) make a needlessly global variable static"
This reverts commit 079ce95b98.

As explained in the comment that it modified, predicted in the #5159
discussion and reproduced in test #5290 /
https://github.com/thesofproject/sof/runs/4988844402, this commit broke
'CONFIG_TRACE=n'. Simple reproduction steps:

 $ rm -rf zephyrproject/build-apl

 $ echo 'CONFIG_TRACE=n' >> \
    boards/xtensa/intel_adsp_cavs15/intel_adsp_cavs15_defconfig

 $ sof/scripts/xtensa-build-zephyr.sh [ -p /path/to/zephyrproject ]  apl

fw abi main version:	3.20.1
fw abi dbg version:	5.3.0
warning: can't find section .static_log_entries in zephyr/zephyr.elf
error: section .static_log_entries can't be found
error: unable to write dictionaries, -22

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-31 11:02:23 +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
Guennadi Liakhovetski 079ce95b98 zephyr: (cosmetic) make a needlessly global variable static
_smex_placeholder dowsn't have to be global, make it static.
Also no need to explicitly specify smex_placeholder_f() as inline,
the compiler will decide by itself.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-20 17:05:10 +00:00
Guennadi Liakhovetski 1c6ae93d92 platform/zephyr: use an OS call for time stamps
On generic Zephyr platform case, use an OS timer call to get a time
stamp.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-01-20 17:05:10 +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