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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
`_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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
_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>
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>
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>
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>
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>
Two directories for cAVS 2.0 and 2.5 in Zephyr CMakeLists.txt don't
exist. They're safely ignored, but remove them to avoid confusion.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Discovered the hard way that the Zephyr build assumes sof-logger is
always up to date when present. It's not clear from cmake's
ExternalProject documentation why that is the case. In any case
BUILD_ALWAYS fixes the issue and takes very little time because it does
not rebuild sof-logger from scratch. BUILD_ALWAYS is already used for
XTOS.
Fixes commit f6c71c21d0 ("zephyr/CMakeLists.txt: build smex and
sof-logger")
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Zephyr commit 174cb7f9f183 switched 'atomic_t' from 'int' to
'long' and broke SOF compilation as shown below.
Recent SOF commit 970d7d61ec ("zephyr: update print messages for
64-bit atomics") switched all atomic_read() logs to "%ld" instead of
"%d" which fixed compilation with Zephyr after the switch but broke it
with Zephyr _before_ the switch.
This no-op (long) cast makes SOF compatible with Zephyr both before and
after the switch.
Note the sof-logger does not make any difference between %ld and %d and
does not care.
Sample failure:
src/lib/dma.c: In function 'dma_get': sof/src/include/sof/trace/trace.h:290
error: format '%d' expects argument of type 'int', but
argument 5 has type 'atomic_val_t' {aka 'long int'} [-Werror=format=]
290 | printk("%llu " format "\n", platform_timer_get(NULL), \
| ^~~~~~~
sof/src/lib/dma.c:119:2: note: in expansion of macro 'tr_info'
119 | tr_info(&dma_tr, "..., busy channels = %d", atomic_read(...))
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Primary core during going to D0i3 state disables all another cores
in platform_pg_int_handler() function. Before it secondary cores
should be prepared (disable interrupts, perform writeback) in order
to make proper restore flow after D0i3->D0 transition.
This commit adds cpu_secondary_cores_prepare_d0ix() function in
ipc_pm_gate() handler, which sends idc to secondary cores
with information that they should perform preparation for power down
in the next platform_wait_for_interrupt() invocation. In
platform_wait_for_interrupt() there is cpu_power_down_core()
invocation with CPU_POWER_DOWN_MEMORY_ON (performs writeback/invalidate,
disables interrupts), when proper flag is set.
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
This will add missing secondary cores restore on wake up,
simple pm_runtime_get(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID)
in lps is not enough in multicore scenario
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Instead of hard-coding a guessed heap size, obtain remaining free
SRAM from the linker and use it completely for the heap.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
As of July 2021 we support (too) many tracing options and this
duplication is unfortunately the only way I found to support them all
while giving the compiler the opportunity to optimize away as many
strings as possible.
Supported configurations:
- Systems with limited memory and zero space for full strings, must use
SOF dictionary only.
- Systems with enough space for all strings to be in memory.
- Anything in between
- Support to duplicate only important message to both the DMA and the
mailbox (the default)
- CONFIG_TRACEM: supports duplicating ALL messages to both the DMA and
the mailbox
- CONFIG_TRACEV: supports deleting verbose statements at compile time to
save space
- CONFIG_TRACE: support turning off all traces at compile-time
- SOF dict trace de-duplication a.k.a. "adaptive filtering"
- Dynamic log levels per component
- Redirection to Zephyr's shared memory tracing that requires full strings.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Recent changes increased the size of various sections, breaking
linkage again. We need to make the linker calculate the heap size
automatically but until that is ready, reduce the heap size further
to fix the current breakage.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
As per documentation in include/sof/lib/alloc.h, rmalloc from
MEM_ZONE_SYS will always succeed. In the unlikely case the alloc
fails, trigger a system panic in rmalloc().
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add caching to more heap zones. With addition of SYS, SYS_RUNTIME
and RUNTIME the mapping is now aligned with XTOS allocator.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>