Commit Graph

8931 Commits

Author SHA1 Message Date
Marc Herbert d0bc72290a test/tplg-build.sh: remove spurious xargs -n1 option
The xargs option `-I/--replace` hardcodes max lines `-L 1`. In other
words, it always splits the input line by line and ignores whitespace
delimiters inside each line. Initial xargs commit
d0f4aba934 ("topology: speed up topology build") used `--replace`
after `-n/--max-args=1` which was silently ignored by xargs version
4.7.0. Now xargs 4.8.0 prints the following warning:

  xargs: warning: options --max-args and --replace/-I/-i are mutually
        exclusive, ignoring previous --max-args value

Remove the ignored `-n 1` to remove the warning.

I compared the outputs before and after this commit and they're exactly
the same.

There's an extra twist. The same xargs command also uses the
`-d/--delimiter=,` option which makes xargs ignore newlines and
"translates" any max-line `-L` option to `--max-args`; including the `-L
1` max implied by `--replace`. This twist does not make a difference:
any max-line or max-args is always overridden by `--replace` whether
`--delimiter` is used or not.

Of course this entire xargs script is re-inventing (C)Make/ninja that
provide build parallelism for free and much more... I digress.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-02 11:25:19 +01:00
Marc Herbert 5b3186f60d .github/zephyr.yml: use new script zephyr/docker-run.sh
Reduces duplication and makes reproduction of issues found in Github
Actions much easier.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-01 16:26:02 +01:00
Marc Herbert 02c1269144 Add new, convenience zephyr/docker-run.sh script
This makes it much easier to run commands in the
ghcr.io/zephyrproject-rtos/zephyr-build container.

Loosely based on scripts/docker-run.sh.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-01 16:26:02 +01:00
Marc Herbert c95d801a99 Revert "github/zephyr.yml: use Zephyr docker-image v0.24.2"
This reverts commit e29572bb2d.

The Zephyr SDK 0.15.0 was exceptionally backwards-incompatible, which
meant the docker image could not have it ahead of time as usual, which
caused some CI failures. More details in
https://github.com/zephyrproject-rtos/zephyr/pull/49496

These CI failures were not a bug, they were a "feature": they drew our
attention to how unusual 0.15.0 was and they let us inform developers
before they hit the issue. Continuous Integration at its best; we want
more of that.

Before this unusual 0.15.0 event we had been using "latest" for many
months without any issue.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-09-01 16:26:02 +01:00
Dobrowolski, PawelX ca3fd09f03 fix: library manager lack of braces
Because of lack of any static analysis tool some braces were missing.

Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-09-01 09:35:57 +01:00
Marc Herbert 0209c464e6 .github/qemu,gcc-build-only: remove byt..icl platforms
Not supported in the main branch anymore, go to stable-v2.3

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-31 21:03:16 +01:00
Marc Herbert e09d853121 installer: remove byt..jsl platforms
Not supported in the main branch anymore, go to stable-v2.3

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-31 21:03:16 +01:00
Marc Herbert 8fee9e1306 xtensa-build-all.sh: remove byt..jsl platforms from '-a'
These platforms are not supported in the main branch anymore.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-31 21:03:16 +01:00
Marc Herbert 8328cc50a9 xtensa-build-all.sh: add rmb to default platforms built with `-a`
The rmb toolchain was added in commit 4e85dfc95f ("docker: add
AMD/Rembrandt gcc toolchain") and before.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-31 21:03:16 +01:00
Arsen Eloglian be5139ad43 volume: cast function parameters to (int64_t)
The parameters px and py in
Q_MULTSR_32X32(px, py, qx, qy, qp) function
must be cast to (int64_t) if other type.

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-08-31 15:00:34 +01:00
Dobrowolski, PawelX adaebb3e43 library manager: allow sending IPC message if buffer is already prepared.
System service functionality used by 3rd party modules expects
that IPC data buffer will be filled with data during
notification preparation. To avoid additional data copy,
provide message buffer directly to module. This requires
that ipc_msg_send() function will not fail if source data pointer will be
equal to destination one.

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-08-31 14:59:51 +01:00
Dobrowolski, PawelX 0fea6d0050 library manager: register loadable library
Adding for ipc4_get_comp_drv check if module is loadable
and for active library manager functionality register it dynamically.

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-08-31 14:59:51 +01:00
Dobrowolski, PawelX b3a19c45e9 ipc4: library manager: handling load library function
Adding function responsible for loading library action after IPC4 message.

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-08-31 14:59:51 +01:00
Dobrowolski, PawelX f31dbc9075 ipc4: library manager communication layer
Commit adds ipc which contains information need to load external
libraries from HOST and required actions to make it possible
using library manager functionality.

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-08-31 14:59:51 +01:00
Dobrowolski, PawelX 4ebcc24bd1 library manager: initial implementation
Library manager is part of loading external libraries responsible of
handling data and placing it in proper order and places.

This feature is using module adapter API for
loadable native and external libraries.

After receiving IPC4 load library command
 - reads manifest
 - after module_id choses module to load and verify it (WIP)
 - loads manifest
 - allocs proper memory size
 - transfer module from external MEMORY to HPSRAM (WIP)

Signed-off-by: Stelter, Jaroslaw <jaroslaw.stelter@intel.com>
Signed-off-by: Dobrowolski, PawelX <pawelx.dobrowolski@intel.com>
2022-08-31 14:59:51 +01:00
Seppo Ingalsuo 65687d0c6b Test: cmocka: Add unit tests for matrix library
This patch adds four unit tests for 16 bit matrix multiplication.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-31 14:45:32 +01:00
Seppo Ingalsuo 28c7cbcfac Math: Add library for matrix functions
This patch adds a matrix arithmetic library start. Currently it supports
matrix initialization, clear, set values, get values, and a multiply
function for 16 bit fractional format. Multiplication functions exist
for normal matrix multiply and element-wise multiplication.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-31 14:45:32 +01:00
Serhiy Katsyuba 7b1906e7fa ipc4: fix for copier supported topologies
This fix replaces the previous copier_copy() implementation there
some required input/output combinations were not supported.

TODO: multichannel ALH case when single stream is produced/consumed
by multiple gateways is NOT IMPLEMENTED by this fix. However,
it was not (properly) implemented in the code being replaced.
So the fix does not bring any loss here.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-08-31 13:43: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 09c52810a7 header: rtos: use rtos specific version of bit.h
No runtime functional change. Code can now include <rtos/bit.h>

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
Serhiy Katsyuba 9fc0badb4d ipc4: add mixin/mixout channel remapping support
Adds channel remapping feature support to mixin/mixout.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-08-31 11:29:46 +01:00
Ming Jen Tai 8496d585d1 Modify periods setting for RTNR capturing pipeline
With the  release of RTNR version 20220728, period for capturing pipeline requires at least 5ms.

Periods setting for 16KHz capturing pipeline is also removed since RTNR is currently running in 48KHz capturing pipeline only.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-08-31 11:26:18 +01:00
Marc Herbert 9915d1e1fd cmake: stop sneakily downloading missing submodules at build time
Note this change does NOT affect Zephyr builds in any shape or form as
Zephyr builds simply don't use the CMake files changed by this commit.

Downloading missing submodules at build time was never a good idea;
always a hack. Downloading and building should always be kept separate
from each other for version control and bill of materials reasons and to
support "off-line" builds; build inputs should always be available.

Now that Zephyr builds have just moved away from git submodules
(replaced by west), stop sneakily downloading missing submodules at
build time while the user cannot notice, overwhelmed by the volume of
build logs. Someone building XTOS first and Zephyr second could
unknowningly end up in a "hybrid" and undesired situation where git
submodules and west would be BOTH pointing at the same rimage clone.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-31 10:40:04 +01:00
Kai Vehmanen 13ba5fe90c tools: add mtrace-reader.py
Tool to stream data from Linux SOF driver "mtrace" debugfs
interface to standard output. Plain "cat" is not sufficient
as each read() syscall returns log data with a 32bit binary
header, containing the payload length.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +01:00
Kai Vehmanen 1daef9e576 app: overlays: move to mtrace for logging for IPC4 overlays
Enable the Zephyr based mtrace backend for all Intel IPC4 platforms.
Also enable routing SOF logs to Zephyr and bump the default
logging level to INFO.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +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
Kai Vehmanen 4abda50153 zephyr: edf_schedule: add support for repeating EDF tasks
Extend the EDF scheduler adaptation to Zephyr to allow repeating
tasks. This allows SOF code to use the per core threads used by
EDF for more usages.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +01:00
Kai Vehmanen e29572bb2d github/zephyr.yml: use Zephyr docker-image v0.24.2
Recommendation from Zephyr infrastructure is to use a specific
version of the docker-image. This time we need this to upgrade
to SDK 0.15, which is a requirement to use latest main of
Zephyr. The current "latest" tag does not have 0.15 SDK.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +01:00
Kai Vehmanen b965236529 west: update to newer Zephyr baseline
Update zephyr to commit dcda3eab8df7 ("tests: net: socket: tcp: move to
new ztest API").

Needed to bring in support for Intel mtrace logging backend.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:33:46 +01:00
Kai Vehmanen 44d555b8e5 selector: fix compiler warnings on unused 'dev'
comp_dbg() statements may be compiled out, so having a 'dev'
variable just for debugs is not useful and just ends up with
compiler warnings on unused variables.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-31 10:31:19 +01:00
Guennadi Liakhovetski 42aec0a186 coherent: make CONFIG_INCOHERENT selectable from menuconfig
At the moment CONFIG_INCOHERENT is automatically enabled when
CONFIG_TIGERLAKE is set and cannot be switched from menuconfig.
Enable that to make debugging with limited cache use possible.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-30 13:01:15 +01:00
Seppo Ingalsuo 40166c699b Math: FFT: Fix possible right shift by negative
Cppcheck found this issue:

src/include/sof/math/fft.h:133:51: error: Shifting by a negative
value is undefined behaviour [shiftNegative]
  output->real = sat_int16((((int32_t)input->real >> n_rnd) + 1) >> 1);
                                                  ^
The case n == 0 need to be handled with the upper if branch non-rounded
shift version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-30 10:53:56 +01:00
Seppo Ingalsuo b4c09d769e Math: FFT: Fix possible null pointer reference
Cppcheck finds this issue

src/math/fft/fft_16.c:23:27: warning: Either the condition '!plan'
is redundant or there is possible null pointer dereference:
plan. [nullPointerRedundantCheck]
 struct icomplex16 *inb = plan->inb16;

There's same issue with inb and outb in both fft_16.c and fft_32.c

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-30 10:53:56 +01:00
Kai Vehmanen b3391900c4 audio: copier: fix always-true comparison in copier_comp_trigger
Fix compiler error related to endpoint field:

src/audio/copier/copier.c:662:13: error: the comparison will always
evaluate as 'true' for the address of 'endpoint' will never be
NULL [-Werror=address]

  662 |         if (cd->endpoint) {
      |             ^~

src/include/ipc4/copier.h:325:26: note: 'endpoint' declared here
  325 |         struct comp_dev *endpoint[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-30 09:07:23 +01:00
Laurentiu Mihalcea 1044e004e4 xtensa: configs: Enable comp legacy on i.MX platforms
PCM capture followed by PCM playback would not work if
done immediately (less than 2s, sof suspend timeout)

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2022-08-29 22:09:57 +03:00
Guennadi Liakhovetski 57995ce1ba pipeline: don't re-add active tasks and copy immediately
In a topology with two connected pipelines, e.g. two playback
pipelines, connected on a mixer, if one PCM is already streaming and
then the other one is started too, two bugs trigger:
1. when adding pipelines to the scheduler, all pipelines are added,
   including any common pipelines behind the mixer
2. the mixer pipeline then gets to run first, while it has no data
   available to it yet.
To fix these bugs
1. don't re-add any active pipelines
2. when a pipeline is added for streaming, let it begin copying
   immediately instead of skipping a period.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-29 17:15:07 +01:00
Seppo Ingalsuo 152c57bb4c Test: cmocka: Add tests for window functions
This patch adds cmocka test cases for window functions library.
The calculated windows are compared with RMS error criteria
to Matlab calculated windows in header files. The header files
are directly generated by script ref_window.m.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-29 17:07:55 +01:00
Seppo Ingalsuo 168d1648a6 Math: Add window functions library
This patch adds a library for window functions. The window functions
are used to mitigate artefacts (from nature of FFT) to spectra when
computing FFT for a finite long chunk of audio. The currently provided
window functions are Blackman, Hamming, Povey, and rectangular.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-08-29 17:07:55 +01:00
Liam Girdwood 7288d52ab6 testbench: cleanup the logging to use printf.
No point in doing a sprintf to a local buffer.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 2865cc2bb2 testbench: cmake: parser does not use CONFIG_LIBRARY cmake variable
Not used by parser cmakefile so delete.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 67ae353bfb tplg_parser: support building as static or shared library.
Allow the tplg_parser to built as either static or shared library.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood d9f9340e1a tplg_parser: split out testbench logic and partition features per file.
This is another tplg_parser and testbench update on the road to provide
further flexibility around supporting new modules and IPC versions.
There will more to follow.

Changes are mostly mechanical code movements i.e. moving testbench related code
to the testbench, splitting the files into per module/component files and
making some functions static and public.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood f507d730ae host: panic: only define assert if not defined.
On host based builds we sometimes see that panic.h redefines assert().
Fix this. This will go away in the future as Zephyr will fully take care
of assert() on host.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood 03b4f30129 testbench: include stdlib.h
Newer GCC version complain about free() not being defined.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Chao Song 7882b1a93d topology2: add pin binding classes for multiple I/O queue
An IPC4 widget may support multiple I/O queue. Queue ID is
required during widget binding in route setup.

This patch adds sink_pin_binging and src_pin_binding classes
for multiple I/O queue support.

For widget requires special pin(queue) binding, sink_pin_binding
or src_pin_binding should be defined in the widget object. So
that the kernel knows which pin to use during widget binding
by parsing topology.

Note that pin binding should be defined for all sink/source pins
or for none. Even if there is only one sink pin requires special
pin binding, pin binding should be defined for all sink pins, and
for pins that are not used, give the value "NotConnected". This rule
applies to source pins, too.

Example: smart_amp widget has two sink pins and one source pin,
and its feedback sink pin requires special pin binding, so we have to
define sink_pin_binding objects within smart_amp object like this:

Object.Base.sink_pin_binding.1 {
    # the main sink pin is connected to host for playback data
    sink_pin_binding_wname	"copier.host.1.1"
}
Object.Base.src_pin_binding.2 {
    # the feedback sink pin is connected to capture dai for codec feedback.
    sink_pin_binding_wname	"copier.SSP.2.1"
}

In this example, smart_amp is connected to host and DAI directly,
it is also possible to be connected to host and DAI indirectly (with
gain or other widget in the middle).

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-08-29 13:26:49 +01:00
Chao Song 721e58f3d2 topology2: add num_sink/source_pins tokens for widget
These two tokens will be used by the kernel to decide the
supported number of sink/source pins, thus to allocate
correct widget queue id in route setup.

These two tokens are mandatory for IPC4 widgets, because
the default value in Linux kernel is zero, which is invalid
for queue id allocation.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-08-29 13:26:49 +01:00
Marc Herbert 92d828bc37 sof-logger: make inotify optional
Restores ability to compile on Windows with MSYS.

Fixes commit dcf0577a77 ("logger: allow starting before the driver is
loaded")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-29 13:24:40 +01:00
Marc Herbert 277985e687 tools: delete obsolete tools/.gitignore
We moved to CMake and out-of-source builds years ago.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-08-29 13:24:40 +01:00