Commit Graph

493 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 5c025b0d9d asrc: enable building as an llext module
Add support for LLEXT building to asrc.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-12 18:07:16 +03:00
Guennadi Liakhovetski ed65e22943 eq-fir: enable building as an llext module
Add support for LLEXT building to eq-fir.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-12 18:07:16 +03:00
Guennadi Liakhovetski dcd21cd0cb volume: add LLEXT support
This makes it possible to build volume as an LLEXT module to be
loaded at run-time.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-12 18:07:16 +03:00
Guennadi Liakhovetski cfd27fbde0 src: convert to a loadable module
Build src as a loadable llext module.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-12 18:07:16 +03:00
Kai Vehmanen 8c619cf740 rtos: add Zephyr implementation of sof/lib/dai.h
Implement sof/lib/dai.h for Zephyr build and do not rely o
the xtos version for Zephyr builds. Add a warning to catch
invalid build configurations.

Link: https://github.com/thesofproject/sof/issues/9015
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-09-11 09:51:33 +03:00
Guennadi Liakhovetski 9f48037505 llext: automatically calculate module addresses
Currently LLEXT module starting addresses are hard-coded in their
respective CMakeLists.txt files. This is very wasteful, since it's
unknown in what order modules are loaded, inflexible and not easily
extendible to other platforms. Switch to calculating addresses
automatically based on a single per-platform Kconfig value.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-10 09:23:24 +03:00
Jyri Sarha fdfddff696 debug: debug_stream_slot: Debug slot transportation for debug_stream
Implementation for debug stream transportation over debug window
slot. The protocol details are documented in debug_stream_slot.h
header.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2024-09-06 12:28:58 +03:00
Marcin Szkudlinski a2813a79bd buf: rename buffer.c to comp_buffer.c and move to buffers
comp_buffer, implemented in buffer.c file, should
be kept in the buffers directory, together with all
buffers
Also it has been renamed to comp_buffer.c

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-02 16:47:40 +01:00
Marcin Szkudlinski d23f8e81d9 buf: add secondary buffer support to struct audio_buffer
secondary buffer mechanism is a feature independent of a buffer
implementation, therefore it should be located in a base class for
all buffers

this commit intentionally is not removing the same feature from
comp_buffer nor trying to use it anywhere

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-02 16:47:40 +01:00
Guennadi Liakhovetski 8b48c563ce drc: move logging context to the base image
Logging context can be accessed from the deferred logging
thread. Therefore it must be always available to avoid
access to unmapped memory when an LLEXT module is unloaded.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-08-30 16:03:28 +03:00
Curtis Malainey a3b1436b46 zephyr: don't build host targets with xtos headers
Posix is for posix

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-08-23 13:36:17 +01:00
Seppo Ingalsuo f7715b814b Audio: MFCC: Fix build of component for current SOF
It has not been possible to build the component earlier for Zephyr
IPC4 systems. This patch makes the next fixes:

- Add SOF_MODULE_INIT() and include of rtos/init.h
- For unit test fix the init function to
  sys_comp_module_mfcc_interface_init()
- To Zephyr/CMakeLists.txt add the needed math library sources
- Add .toml files for rimage for IPC4 systems

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-08-21 14:39:05 +01:00
Tobiasz Dryjanski 3a4c9db40d src: create separate file for normal src
Defines for normal src and src_lite were not separated correctly. Added new
variables so those values can be different depending on the type of src
being used. Those are assigned in prepare function in a new src.c file,
similarly to src_lite.c

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Tobiasz Dryjanski 285ec51914 src: rename src.c to src_common.c
Renaming src.c, as this filename will have a different purpose. File
src_common.c will contain common functions for all src types.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
2024-08-21 13:02:32 +01:00
Laurentiu Mihalcea 2e39952d4b include: rtos: interrupt.h: simplify `interrupt_get_irq` macro logic
The imx-related macro logic from `interrupt_get_irq` can be
simplified. Now that `CONFIG_IMX93_A55` selects `CONFIG_IMX`,
`interrupt_get_irq` should return the INTID for all imx platforms
except for imx8m, which is yet to be transitioned to zephyr
native drivers.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00
Laurentiu Mihalcea 9e9e67c5bd platform: imx93_a55: select `CONFIG_IMX`
i.MX93 is an IMX platform so its config (i.e: `CONFIG_IMX93_A55`)
should also select `CONFIG_IMX`.

Additionally, xtensa-based imx platforms have the heap
placed in the ".heap_mem" section, while arm-based imx
platforms have the heap placed inside the .bss section.
As such, fix the macro-based logic inside `zephyr/lib/alloc.c`
to account for this.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-08-20 11:51:41 +03:00
Eddy Hsu b2521eaa7b comp: Add initial Google CTC component
Introduce a new component to perform crosstalk-cancellation on
the playback path.

Signed-off-by: Eddy Hsu <eddyhsu@google.com>
2024-08-06 13:32:51 -07:00
Serhiy Katsyuba 8082006042 ipc4: pcm_converter: Add channel remapping conversion functions
Adds a set of conversion functions that perform both format conversion
and channel remapping. These are required to swap channels for the device
posture feature.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2024-07-17 15:27:41 +03:00
Guennadi Liakhovetski c06ad78195 drc: enable building as an llext module
Add support for LLEXT building to drc. Since multiband DRC calls
functions from DRC, we cannot so far build it if DRC is configured as
a module. In the future it should be possible to build both as
modules and to export symbols between them.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-07-16 15:29:47 +03:00
Guennadi Liakhovetski a98fb5c79c llext: fix Windows builds
Under windows the Python interpreter has to be called explicitly.
Without it an attempt to execute a Python script fails silently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Suggested-by: Marc Herbert <marc.herbert@intel.com>
2024-07-16 15:29:47 +03:00
Marcin Szkudlinski ac17c743d7 kconfig: add PIPELINE_2_0 flag
This flag enables changes to new pipeline structure,
known as pipeline2_0
It is required for certain new features, like DP_SCHEDULER.
The changes are incremental and at the moment pipeline 2.0
is fully backward compatible with legacy platforms, however
it generates some overhead in data and code, so it is useful to
turn if off if not needed

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Marcin Szkudlinski 65ddefc559 buf: Rename dp_queue.c to ring_buffer.c
dp_queue was created as a buffer to handle
special needs for DP modules.
However, in pipeline2.0 there will be more usecases
for it - as in fact it is a lockless cross-core
cached ring buffer.
This commit does rename dp_queue to more adequate name
It also moves the file to "buffers" directory, a place
for all implementations of buffers in pipeline 2.0

The commit, however, does not change names of structures
because git/github does not handle complex changes like
rename and modification correctly

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-07-10 15:31:06 +03:00
Andy Ross 17f46a71ee uuid: Use new UUID registry pervasively
Strip out all the literall UUID management from existing C code (the
API itself still works for any out-of-tree or test code users) and
exclusively use the new, much simpler, SOF_DEFINE_REG_UUID() macro
which sources IDs from the registry by name.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 51a5fb9c80 uuid: Add app-global UUID registry
Add a very simple uuid-registry.txt file containing all known UUIDs in
the tree, use it to generate a C header (the script validates it in
the process) that can then be used for a simplified
SOF_DEFINE_REG_UUID() mechanism that avoids the risk and temptation
temptation of components incorrectly implementing UUIDs.

The intent is that in the longer term, this file can be used by other
downstream tooling (manifest and topology generation) to more easily
reference known IDs by name in a way that avoids duplication and
error.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 321d32b77d uuid: Use Zephyr ITERABLE sections for the UUID table
Zephyr has a similar trick to the .static_uuids trick SOF had been
playing that works in a (mostly) portable way and has some nice
features like runtime FOREACH iteration.

Use that for the UUID table, allowing it to be linked in globally in
Zephyr builds in a uniform way.

Also includes some general cleanup to try to reduce the amount of
backslashery required to express the various macros.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross a3c1b75808 uuid: Rename DECLARE_SOF(_RT)?_UUID() -> SOF_DEFINE_UUID()
Complete the unification of the diverged UUID APIs with a big rename.
Call it "DEFINE" instead of "DECLARE" since this is in fact a C struct
definition and not just a declaration of a type or extern symbol.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross 0868b1f71e zephyr: Remove legacy logging artifacts
The sof-logger/smex tools and the .ldc formats are all dead code in
Zephyr builds.  The logging/trace macros don't emit the correct
metadata anymore, using Zephry logging instead (and I don't think they
ever did?), and the resulting .ldc files are degenerate containing
just the header and the records for component UUIDs, which nothing
uses.

Save a few milliseconds of build time and a few bytes of output, and
free up the evolution path by not having to support legacy tools.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Kai Vehmanen 997e536a73 zephyr: shell: add initial SOF custom commands
One of the benefits and common ways to use the Zephyr shell
subsystem is definition of application specific commands.

This commit adds the initial SOF custom command,
"sof test_inject_sched_gap". This new command allows to inject
scheduling gaps into low-latency timer scheduler execution,
using the domain_block() SOF interface. Optional argument
can be used to specify duration of the block in micro seconds.

The intent is to stress test a SOF configuration and test how
the system behaves when audio pipeline is briefly starved.

Example log of what is observed when test_inkect_sched_gap is
run:

[    0.052431] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3674, max 4326, overruns 0
[    0.052831] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 3673, max 4318, overruns 0
~$
~$ sof test_inject_sched_gap 12000
[    0.052968] <inf> ll_schedule: zephyr_domain_block: Blocking LL scheduler
[    0.052973] <inf> ll_schedule: zephyr_domain_unblock: Unblocking LL scheduler
[    0.052973] <inf> host_comp: host_get_copy_bytes_normal: comp:1 0x10004 no bytes to copy, available samples: 0, free_samples: 384
[    0.053231] <inf> ll_schedule: zephyr_domain_thread_fn: ll core 0 timer avg 4074, max 437230, overruns 1

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-07-04 15:05:13 +01:00
Jaroslaw Stelter 05bfc36dac ptl: Add initial PTL configuration
Patch adds PTL configuration basing on MTL

DMIC depends on PM_DEVICE_RUNTIME and PM_DEVICE_POWER_DOMIAN settings.
To effectively enable DMIC these flags must be set.
Additionally DMIC Ownership bit is not supported on ACE 2.0 and ACE 3.0.
Therefore CONFIG_DAI_DMIC_HAS_OWNERSHIP is switched off.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2024-06-24 16:15:41 +02:00
Dobrowolski, PawelX 1704870309 cmake/zephyr: change if condition to zephyr metod
For syntax clearity changed if conditional to zephyr method

Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2024-06-24 16:15:41 +02:00
Jaroslaw Stelter 6102aaca5e intel_adsp: ptl: Fix SOF compilation without PM
PTL has CONFIG_PM disabled. SOF should still build without
this configuration flag. This patch fixes the compilation issue.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2024-06-14 15:14:36 +03:00
Guennadi Liakhovetski c79628308f llext: don't build if CONFIG_LLEXT=n
Not all configurations need LLEXT, don't include LLEXT support in
such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-12 11:07:35 +01:00
Guennadi Liakhovetski 1673b1097e west: update to Zephyr "main", fixing disabled LLEXT builds
Fixes, needed for a recent Zephyr head plus a PR to fix
CONFIG_LLEXT=n builds.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-12 11:07:35 +01:00
Guennadi Liakhovetski 0bda13d0bd llext: check a Kconfig option to select ld flags
When using xt-clang we cannot build shared objects, so we use '-r' to
link relocatable objects. But the decision shouldn't be made based on
the name of the compiler, but based on the selected LLEXT_BINARY_TYPE
option.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-04 12:53:49 +03:00
Kai Vehmanen 013e210209 west.ytml: update to Zephyr 53ddff639562
Update Zephyr baseline to 53ddff639562 . The location of generated
headers has changed, so modify the SOF build scripts to use the new
location.

Change affecting SOF build targets:

6509b8199b02 shell: add shell backend for audio DSP using shared memory window
5a7600bec60b soc: intel_adsp: tools: add shell support to cavstool.py
db00b813f043 soc: intel_adsp: tools: align code style in maps_regs()
44dd5a4da9c0 soc: intel_adsp: tools: fix ace20 fw load flow
fa798ce2d5be soc: intel_adsp: only implement FW_STATUS boot protocol for cavs
8fc76f1b6d16 soc: intel_adsp: tools: improve FW boot handling on ace1.x
024bd41efb65 llext: xtensa: add support for the xt-clang toolchain

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-06-04 11:04:04 +03:00
Guennadi Liakhovetski d6ee13c37c ipc: simplify CMakeLists.txt by using a suffix variable
Everywhere, where IPC3 and IPC4 are distinguished in CMakeLists.txt
the only difference is the use of x_ipc3.c vs. x_ipc4.c. Instead of
duplicating all build instructions for IPC3 and IPC4 just define and
use a suffix variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-06-03 18:44:02 +03:00
Marc Herbert 2e6162bf78 zephyr/cmake: fix llext.uuid growing from the last build
Reset the llext.uuid file so it does not start with content from the
previous build.

Fixes LLEXT incremental builds which apparently never worked (some
people like it slow?)

Fixes commit 05e69e1bb9 ("llext: update to use add_llext_target()")
and the ones before that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-05-27 13:04:58 +03:00
Adrian Warecki 5081044f3d regions_mm: New memory mapping functions
The previous memory mapping function did not work properly if the buffer
size exceeded the memory page size. In this case the size of the region to
be checked passed to the sys_bitarray_is_region_cleared function was zero,
causing the function to always return false. As a result, the allocator
stated that a page was already mapped for a given address and did not map
it. This led to a cpu exception when trying to access the allocated buffer.

The function responsible for unmapping memory had a similar problem.
Additionally, the size of the freed area was incorrectly determined and
an incorrect offset was passed to the sys_bitarray_is_region_cleared
function.

New functions have been created to map and unmap memory pages for allocated
buffers. It don't need allocation of temporary array and manipulation of
memblocks bitarray.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-05-24 12:46:39 +03:00
Adrian Warecki cabc2e84a3 regions_mm: Use static initialization of the vmh_list list head
A macro was used to statically initialize the vmh_list list head. This
allowed to resign from calling a function whose only task was to initialize
the list header. This function was removed as no needed anymore.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2024-05-24 12:46:39 +03:00
Guennadi Liakhovetski f86ad4fa20 eq-iir: convert to a loadable module
Build eq-iir as a loadable llext module.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-14 14:37:44 +01:00
Guennadi Liakhovetski 753e363f0f mixin-mixout: make modular
Convert mixin-mixout to a loadable llext module.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-14 14:37:44 +01:00
Guennadi Liakhovetski 05e69e1bb9 llext: update to use add_llext_target()
Zephyr now provides a convenient cmake API for LLEXT modules, update
SOF to use it by defining common cmake functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-14 14:37:44 +01:00
Tomasz Lissowski 4f3e4f98ac cadence: add support for mp3 encoder
This adds support for Cadence MP3 Encoder module.

Signed-off-by: Tomasz Lissowski <tomasz.lissowski@intel.com>
2024-05-09 10:49:09 +01:00
Andy Ross e7f76eec4d platform/posix: Unbreak fuzzer support
Upstream Zephyr moved the LLVM fuzzer entry point out of the arch
layer and made it an app responsibility, so we broke.  Add back the
support here that got removed.

Fixes #9101

Signed-off-by: Andy Ross <andyross@google.com>
2024-05-09 11:13:15 +03:00
Kai Vehmanen b10ec85ebd audio: base_fw: do not use platform interface for vendor extensions
In commit 14c4e86757 ("audio: base_fw: add platform layer to IPC4
hw_config data"), the platform specific code was moved to platform
layer.

This commit implements a lighter weight abstraction for the moved
code. Instead of using the platform layer, the Intel specific vendor
code is added directly in base_fw_intel.c and guarded by a Kconfig.
All other IPC4 build targets will use an empty implementation.

This avoids the need to add a platform definition for all IPC4 targets.
The common implementation in base_fw.c is sufficient to cover all
mandatory functionality required e.g. by the upstream SOF Linux driver's
IPC4 implementation.

The interfaces are renamed to refer to "vendor" instead of "platform",
to avoid any confusion with the platform layer with the new
implementation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-05-08 09:41:28 +01:00
Guennadi Liakhovetski 9a2d1a6f05 module: support multi-module builds
To be able to build and sign multiple modules within one build we
need to unify name generation. For signing we invoke something like
west sign -i smart_amp_test
which means, that the west sign utility must be able to locate the
module binary directory and recognise files in it using only that
input file name. It will then create signed llext images inside those
binary directories too, so that deployment scripts can find and
recognise them there. We unify the naming as
${MODULE}_llext - for the binary directory,
${MODULE}.so - ELF file for signing in that directory
${MODULE}.llext - final signed extension
llext.uuid - a file with a list of UUIDs, provided by this extension

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-05-07 10:51:34 +03:00
Laurentiu Mihalcea 65b8a32f27 nxp: imx8ulp: switch to native Zephyr drivers and timer domain
Switch to Zephyr native drivers and timer domain. This
includes:
	1) Switching all imx8ulp topologies to timer domain.
	2) Disabling Zephyr DMA domain
	3) Various interrupt-related fixes via Kconfig-related
	ifdef logic.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-04-25 14:12:41 +03:00
Laurentiu Mihalcea b78d924fe8 lib: dma: add entries for 8ULP's EDMA2 and HOST_DMA
Add entries for 8ULP's EDMA2 and HOST_DMA.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-04-25 14:12:41 +03:00
Laurentiu Mihalcea 9737e124bc nxp: imx8/imx8x: switch to native Zephyr drivers and timer domain
This commit includes all necessary changes for switching
to timer domain and Zephyr native drivers on imx8 and imx8x.
This consists of:
	1) Switching all imx8 topologies to timer domain.
	2) Disabling Zephyr DMA domain
	3) Various interrupt-related fixes via Kconfig-related
	ifdef logic.

This commit includes all necessary changes for switching
to native Zephyr drivers on imx8/imx8x.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-04-23 12:20:31 +01:00
Laurentiu Mihalcea 0b88030785 lib: dma: add entries for imx8/imx8x's EDMA0 and HOST_DMA nodes
Add entries for EDMA0 and HOST_DMA nodes.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-04-23 12:20:31 +01:00