Commit Graph

12582 Commits

Author SHA1 Message Date
Seppo Ingalsuo 77dec14d91 Audio: Copier: Remove not necessary header for testbench build
The include of dai-zephyr.h causes IPC4 testbench build to
fail due to further include of Zephyr headers. Since the
copier_generic.c build is not needing it, it can be removed.

The HiFi build version copier_hifi.c is already without
this include.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-03 17:44:57 +03:00
Seppo Ingalsuo 10c1cd72d1 Lib: Add to dai-legacy.h struct copier_gain_params for testbench
The new copier gain feature needs this structure. The added
member is copied directly from dai-zephyr.h. Testbench IPC4
is using legacy DAI definitions instead of Zephyr DAI to avoid
to include a lot of difficult dependencies. Build of testbench
fails if dai-legacy.h does not contain this.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-03 17:44:57 +03:00
Laurentiu Mihalcea 8c053e6415 west.yml: update Zephyr to 155f3f3ba688
Includes the following changes potentially relevant to SOF:

155f3f3ba688 west_commands: sign: add imx95 to target list
01754956de29 boards: nxp: imx95_evk: add rimage support for m7 ddr variant
848907c0f81d soc: imx: imx95: enable cache management for M7
f3e870dfa5d4 boards: nxp: imx95_evk: add edma and sai nodes

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-10-03 12:13:26 +01:00
Marcin Szkudlinski f9b1a1deea buf: use buffer sink API in components
This commit makes all components use API for accessing
the previous/next component

pipeline code, like module adapter or ipc helpers was
omitted intentionally

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-10-02 15:02:12 +01:00
Marcin Szkudlinski 40eac5da3d buf: use buffer source API in components
This commit makes all components use API for accessing
the previous/next component

pipeline code, like module adapter or ipc helpers was
omitted intentionally

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-10-02 15:02:12 +01:00
Marcin Szkudlinski 684cbb978d buf: a helper for checking state of component added
A typical action for a component is to check if a
prev/next component exists and is ready to provide/consume data:

if (buf->sink && buf->sink.state == STATE_....)

In pipeline 2.0 it should be done by a state
of sink/src API, but for now a helper for the operation
is provided by this commit.

In case the component does not exists, a special state
COMP_STATE_NOT_EXIST is introduced

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-10-02 15:02:12 +01:00
Marcin Szkudlinski 3c672d2681 buf: provide API to access sink/source components
An API for accessing components providing and
consuming data from the buffer added

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-10-02 15:02:12 +01:00
Marcin Szkudlinski 7142931d19 comp: remove unused parameter from comp_get_state
param req_dev Requesting component was unused

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-10-02 15:02:12 +01:00
Curtis Malainey 52e944036d fuzz: add support for 64 bit builds
This is needed for MSAN

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-10-02 14:41:32 +01:00
Curtis Malainey a9481c67c3 fuzz: fix size type
Fix silent overflow in the fuzzer. 255 is clearly << 65536 so that means
we are not able to exercise the full buffer. But upon further inspection
its clear that numbers are a minimum truncated if not rolling over based
on the code in the size_t to uint8_t conversions.

This was validated by converting the type temporarily to signed and
observing the fuzzer using a negative index.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-10-02 14:40:25 +01:00
Curtis Malainey 0ba94ef8f5 oss-fuzz: delete outdated files
All fuzzing infra has moved to the posix platform. The corpus is not
being deployed, and is soon to be modified anyways. Its also missing
IPC4 in the corpus.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-10-02 14:40:25 +01:00
Ranjani Sridharan addc349d6a ipc4: helper: Remove hardcoded UUID map for CONFIG_LIBRARY
Always append the UUID to the end of the module init IPC data and use
that to look up the component driver instead of using the hardcoded UUID
map. This will make it easier to support new processing elements with
the plugin/testbench. Also, modify the get/set_large_config handlers to
use the component driver set in the dev instead of looking it up again.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-10-02 15:03:56 +03:00
Peter Ujfalusi 6949112cce tools: mtrace-reader.py: Add option to mark chunk starts in output
Sometimes it can help to see how the chunks arrive from firmware when
comparing logs with the kernel for example.

The --mark-chunks flag will add a marker for each new chunk that is printed
with a running number and the size of the given chunk, for example:

--- Chunk #604 start (size: 652) ---
[    0.000000] <inf> init: print_version_banner: FW ABI 0x301d001 DBG ABI 0x5003000 tags SOF:v2.5-stable-branch-2772-g76e650e56598-dirty zephyr:v3.7.0-2127-ge7c84756087f src hash 0x4ff3fd64 (ref hash 0x4ff3fd64)
*** Booting Zephyr OS build v3.7.0-2127-ge7c84756087f ***
[    0.000000] <inf> main: sof_app_main: SOF on intel_adsp
[    0.000000] <inf> main: sof_app_main: SOF initialized
[    0.000000] <inf> ipc: ipc_cmd: rx   : 0x44000000|0x31400008
[11896.403666] <inf> ipc: ipc_cmd: tx-reply     : 0x64000000|0x31400008
[11896.404076] <inf> ipc: ipc_cmd: rx   : 0x44000000|0x3060004c
[11896.404093] <inf> ipc: ipc_cmd: tx-reply     : 0x64000000|0x3060004c
--- Chunk #605 start (size: 196) ---

[11896.969658] <inf> ipc: ipc_cmd: rx   : 0x11000005|0x0
[11896.969671] <inf> pipe: pipeline_new: pipeline new pipe_id 0 priority 0
[11896.969685] <inf> ipc: ipc_cmd: tx-reply     : 0xb1000000|0x0

--- Chunk #606 start (size: 2236) ---

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-10-01 20:39:11 +03:00
Tomasz Leman a1a5b1d4a0 ipc4: base_fw: Enable scheduler info retrieval for secondary cores
This commit addresses the limitation in the schedulers_info_get function
where scheduler information could only be retrieved for the primary
core. The updated implementation now validates the core_id against the
number of configured cores (CONFIG_CORE_COUNT) and initiates an IPC
process on the requested core if it is not the current core.

Changes include:
- Adding a check to ensure the core_id is within the valid range.
- Calling ipc4_process_on_core to handle IPC processing on secondary
  cores.
- Returning appropriate IPC4 error codes based on the result of
  ipc4_process_on_core.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-10-01 20:33:16 +03:00
Guennadi Liakhovetski a2cbd744db Revert "ipc3: override type field once comp_driver found"
This reverts commit b53573a15c. This
commit broke cmocka unit tests.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-10-01 10:21:16 -07:00
Ievgen Ganakov b6f6f6aee4 copier: dai: apply gain feature
Add gain configuration and apply gain processing in copier dai.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-10-01 14:08:09 +01:00
Ievgen Ganakov 0c9094bcc5 copier: gain: add dma control ipc handling
Add methods to update gain coefficients in runtime by handling
DMA CONTROL IPC message being sent to specific dai device based
on provided node id.
Check for unity gain flag.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-10-01 14:08:09 +01:00
Ievgen Ganakov 6993617c25 copier: gain: add processing functions
Add HIFI and generic versions of gain processing for
32-bit and 16-bit container size.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-10-01 14:08:09 +01:00
Ievgen Ganakov d64be92617 copier: gain: add basic configuration
Prepare infrastructure for copier gain feature. Add basic configuration
scenario.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2024-10-01 14:08:09 +01:00
Tomasz Leman c3b845adb8 ipc4: base_fw: Consistently use IPC4 status codes
This patch addresses the issue of inconsistent error code usage in the
base_fw.c file, where a mix of POSIX and IPC4 error codes was previously
present.

The IPC4 error codes are now used consistently throughout the file,
ensuring that the error handling is aligned with the IPC4 protocol
expectations. The changes include replacing POSIX error codes such as 0,
-EINVAL, and -ENOMEM with their corresponding IPC4 status codes
IPC4_SUCCESS, IPC4_ERROR_INVALID_PARAM, and IPC4_OUT_OF_MEMORY,
respectively. This standardization helps to avoid confusion and
potential bugs that can arise from the mixed usage of different error
code conventions.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-10-01 14:05:05 +01:00
Seppo Ingalsuo 421a6dff03 Audio: Mux: Handle correctly mux/demux mode
Since with module adapter the component type from init IPC
is no more SOF_COMP_MUX or SOF_COMP_DEMUX but
SOF_COMP_MODULE_ADAPTER, the mux mode check needs to be change.
The type is set in init() based on which init function was
used.

All checks for dev->ipc_config.type are changed to check of
cd->comp_type. The set of type in mux_ipc4.c is removed.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:56:16 +01:00
Seppo Ingalsuo 64bd786088 Test: Cmocka: Set component type to SOF_COMP_MODULE_ADAPTER
The change done in commit b53573a15c
("ipc3: override type field once comp_driver found") expects
the component type via init IPC to be the same as module
register sets (SOF_COMP_MODULE_ADAPTER).

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:56:16 +01:00
Curtis Malainey 31e22e6373 buffer: init channels to 2
On initialization we use rzalloc which 0s out all fields. We later call
audio_stream_recalc_align which uses the frame_bytes to align the buffer.
This is problematic as clz() is passed the size of the frame size which
is 0 since channel is 0 and passing 0 to clz is undefined behaviour.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2024-10-01 13:54:38 +01:00
Kai Vehmanen 66bb497da8 xtos: move sof/lib/perf_cnt.h to application interface
The SOF perf_cnt.h provides a simple performance counter interface that
is used in SOF to track performance at audio module and pipeline level.

Majority of the implementation is RTOS agnostic, relying on
sof_cycle_get_64() to sample platform clock, and timer_get_system() for
CPU clock, both defined in rtos/timer.h. There is however some
conditional rules for Zephyr to use timing_counter_get() if SOF is built
with CONFIG_TIMING_FUNCTIONS=y.

The amount of RTOS variation does not seem to warrant branching the
whole perf_cnt.h to RTOS layer. Move perf_cnt.h back to application
interface, so the single implementation can be shared.

Link: https://github.com/thesofproject/sof/issues/9015
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-10-01 13:45:26 +01:00
Alexander Brown 23d3d55139 Implement gui and tui for sof demonstration
Implements a gui and tui that can be used to easily demonstrate SOF
on target HW. See README and README-dev for more information on
functionality and purpose.

Signed-off-by: Alexander Brown <alex.brown.3103@gmail.com>
2024-10-01 13:30:33 +01:00
Seppo Ingalsuo e5a2746c38 Tools: Testbench: Add README.md text
This text add helps with various usages for testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo fbb9d78413 Tools: Testbench: Rename common_test C source files to utils
The utils is a better description of the purpose of the functions
in these files. There's no change to functionality.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 4730ac5b45 Tools: Testbench: Add IPC4 support
This patch adds topology parsing and common functions versions
for IPC4.

Due to dai_get_init_delay_ms() implementation in IPC4 build
the file component is changed internally to copier to provide
the DAI data struct. The change is common for both IPC3 and IPC4
though copier is not usually used with IPC3 systems. Since it
works the same solution is used. The file state retrieve is changed
because the file component data is placed deeper into the
structures.

Due to IPC4 scheduling of pipelines the file component is added
a timeout. A file component sets timeout status if there has
been three copy operations with no data to process. The timeout
and EOF are used to end cleanly the test run.

The library_defconfig still has CONFIG_IPC_MAJOR_4=n. The add
of build type select to scripts/rebuild-testbench.sh is further
work. Also the IPC4 testbench in this state is not well usable
with only one component supported as process component and
without byte control set up algorithms.

Test run with DC blocker is possible this way:

tools/testbench/build_testbench/install/bin/testbench
  -r 48000 -R 48000 -c 2 -n 2 -b S32_LE -p 1,2
  -t tools/build_tools/topology/topology2/development/
  sof-hda-benchmark-dcblock32.tplg
  -i in.raw -o out.raw

Also sof-hda-benchmark-gain32.tplg can be run.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 2580953172 Tools: Testbench: Error if filename is empty in file component
This change avoids a segfault. Topologies may contain
non-supported PCMs such as HDMI and if pipelines are not
restricted with -p A,B,C,.. option file might get set up
without filename.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo bf5a3fd63c Tools: Testbench: Cleanup and move common and IPC3 specific functions
The helper functions are moved from testbench.c to common_test.c
and common_test_ipc3.c as preparation to add IPC4 support.

The file components are looked up in test setup to arrays to ease
finding them in test run and control ending the test.

The parse string for command getopt() is fixed to match the
supported options.

The testbench parameter struct is changed to dynamically allocated
and zeroed by calloc(). It also avoids issues found with valgrind
about uninitialized.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo ca12ed2b81 Tools: Testbench: Clean up header files
Prefix macros with TB and add TESTBENCH to headers single time
include control macros. Especially ifndef _TRACE_H is in risk
to conflict with possible other headers.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo e1c0798980 Tools: Testbench: Rename files with IPC3
This change prepares to add IPC4 support to testbench.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 2b7388307b Audio: Volume: Remove two unused variables from peakvolume
The remove of variables in1 and out1 in peakvolume HiFi4
function vol_s16_to_s16() avoids testbench IPC4 build error:

sof/src/audio/volume/volume_hifi4_with_peakvol.c:406:10:
error: unused variable 'in1' [-Werror,-Wunused-variable]

sof/src/audio/volume/volume_hifi4_with_peakvol.c:407:10:
error: unused variable 'out1' [-Werror,-Wunused-variable]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 58c478545b Audio: TDFB: Fix flexible array members in control notification
The build of testbench IPC4 with xt-clang fails with this error:

sof/src/audio/tdfb/tdfb_ipc4.c:31:37: error:
field 'module_data' with variable sized type
'struct sof_ipc4_notify_module_data' not at the end of a struct or
class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]

sof/src/audio/tdfb/tdfb_ipc4.c:32:38: error:
field 'control_msg' with variable sized type
'struct sof_ipc4_control_msg_payload' not at the end of a struct or
class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]

The issue is fixed with use of struct pointers to IPC message
msg_module_data and msg_payload to prepare the message template.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo a5f56e7f18 Audio: Crossover: Fix IPC4 testbench build
The crossover_init_output_pins() function is changed to static.
This change avoids build error:

sof/src/audio/crossover/crossover_ipc4.c:32:5:
error: no previous prototype for ‘crossover_init_output_pins’
[-Werror=missing-prototypes]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 3afccf93d3 Audio: Component: Add module headers to component.h for testbench
Components initialize in testbench needs these headers. Adding
these allows load of to the components when found in topology.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 515774fce2 IPC: IPC4: Add File and dcblock to UUID map
This addition allows to load file components for DAI
and host copier replacement for testbench. DC blocker
is added as process component to allow testing of this
component as example. Support for other processing
components will need a new solution to pass the UUIDs
over IPC messages instead of the 8-bit index value.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo a1b029bc0a IPC: IPC4: Remove unused function process_dma_index()
Warnings are errors in testbench build. This change avoids error:

sof/src/ipc/ipc4/helper.c:761:19:
error: unused function 'process_dma_index' [-Werror,-Wunused-function]

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 6d1b839e46 IPC: IPC4: Initialize IPC reply to zero ipc_cmd()
This change fixes a Valgrind reported issue of use of
uninitialized data.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 566785dd2f IPC: IPC4: Skip ipc_wait_for_compound_msg() for CONFIG_LIBRARY
This prevents the IPC4_FAILURE since there is no parallel
execution in scheduler and pipelines with this IPC request
and respond step.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo f82d0fc57e IPC4: Add missing header include to alh.h
The use of size_t needs include of stddef.h. Without this
there is build error in copier_hifi.c:

sof/src/include/ipc4/alh.h:70:15: error: unknown type name ‘size_t’

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo dc0a3513c4 Lib: Dai-legacy: Add chmap and channel_copy members to struct dai_data
This avoids compile error in copier.c:

sof/src/audio/copier/copier.c:692:34:
error: ‘struct dai_data’ has no member named ‘chmap’

and in copier-dai.c:

sof/src/audio/copier/copier_dai.c:550:34:
error: ‘struct dai_data’ has no member named ‘channel_copy’

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Seppo Ingalsuo 6abe40263d platform: library: Add missing include task.h to ll_schedule
This fixes build issues

In file included from tools/testbench/common_test.c:5:
src/platform/library/include/platform/lib/ll_schedule.h:22:51:
error: ‘enum task_state’ declared inside parameter list will not
be visible outside of this definition or declaration [-Werror]

In file included from tools/testbench/common_test.c:16:
tools/testbench/build_testbench/sof_ep/install/include/sof/
schedule/ll_schedule.h:40:5:
error: conflicting types for ‘schedule_task_init_ll’

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2024-10-01 13:18:28 +01:00
Marcin Szkudlinski 64cb13364e buf: move chmap to stream_params structure
chmap is a parameter common for all types of buffers, should be
accessible through sink/src api, so it needs to be kept in
sof_audio_stream_params

an API inroduced for accessing the parameter

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-27 13:32:58 +03:00
Marcin Szkudlinski e331b9ccaf buf: move walking flag to sof_audio_buffer structure
walking flag is not really needed for data buffering,
rather for pipeline iteration procedures, so it should
not be in sof_audio_buffer structure. But before in order
to make possible usage of other buffer types than comp_buffer
before pipeline2.0 is ready, it must be kept there.

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-27 13:32:58 +03:00
Marcin Szkudlinski 7033e159ee buf: move hw_params_configured flag to stream_params structure
hw_params_configured is a flag indicating that a buffer params has
been already set, and should be kept in the same structure as the
params themselves

this commit moves hw_params_configured to sof_audio_stream_params
and introduces API to handle the flag

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-27 13:32:58 +03:00
Marcin Szkudlinski 4a8a356ac9 buf: move is_shared flag to audio_buffer structure
is_shared is a flag indicating that a buffer is shared
between cores.
This property is common for all types of audio buffers and
should be kept in a base structure

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-27 13:32:58 +03:00
Marcin Szkudlinski e9d1a8edc5 buf: grammar fixes in comments
a first / the first
procedure / function

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-27 13:32:58 +03:00
Kai Vehmanen b70d2bf54d app: winconsole_overlay: disable SOF telemetry perf measurements
SOF telemetry performance measurement tools use the same window 3 as the
DSP winstream log backend, so the two cannot be enabled at the same
time.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-09-26 18:31:18 +01:00
Kai Vehmanen 6f243d9c18 app: shell_overlay: disable SOF telemetry perf measurements
SOF telemetry performance measurement tools use the same window 3 as the
DSP winstream log backend and the latter is enabled in the shell
overlay. Disable the conflicting feature.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-09-26 18:31:18 +01:00