Commit Graph

9277 Commits

Author SHA1 Message Date
Pin-chih Lin 5270e631c3 dts: handle zero config size case in set_configuration
The generic module_set_configuration function returns 0 early when
the coming config size is 0. In aspect of DTS module, receiving 0
from module_set_configuration call means either config is obtained
succesfully or no config (size is 0). The present code doesn't
handle the latter case.

This commit handles the case in DTS module by early return.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-12-21 13:31:09 +00:00
Pin-chih Lin fc497eb448 topology: remove default param config from DTS control
In DTS module m4 file, the default control bytes used to have a
12-byte redundant param {0x0000, 0x000c, 0x0000}, the param id is
0 (the first 4-byte).

For DTS SDK version >= 1.0.8, error is reported while getting the
param with id=0.

This commit removes the redundant param from default control bytes.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-12-21 13:31:09 +00:00
Kai Vehmanen 1a7a36a84c sof-logger: ensure NULL string is not passed to printf/fprintf
Due to allocation failures, or invalid content in dictionary,
"params" entries in "struct proc_ldc_entry" may be NULL.

In print_entry_params(), the NULL entries may be passed
as arguments to fprintf(). While e.g. glibc handles these without
error, this is not guaranteed behaviour and may result in segfault
on some platforms.

Fix the issue by aborting program if allocation fails and
explicitly handling the cases when asprintf_entry_text returns
NULL.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-12-21 13:03:44 +00:00
Gongjun Song 89b1f5054a topology1: add sof-rpl-rt711-l0-rt1318-l12
Add sof-rpl-rt711-l0-rt1318-l12. This tplg doesn't include any
local MICs.

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
2022-12-21 12:12:04 +00:00
Gongjun Song 0144769229 topology1: add sof-rpl-rt711-l2-rt1316-l01
Add sof-rpl-rt711-l2-rt1316-l01. This tplg doesn't include any
local MICs.

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
2022-12-21 12:12:04 +00:00
Tomasz Leman fa0456e5a8 audio: dai-zephyr/host-zephyr: stop dma only once
Until now, one dma channel could be stopped multiple times without any
problems. From commit af6d827b64 on zephyr it is required that the start
and stop calls be perfectly balanced.

Zephyr device power manager stores an internal counter. Counter is
incremented if device is used and decremented on device release. In this
case when we call dma_start() and dma_stop().

If dma_stop() is called more times than dma_start() power manager will
reaport a error -EALREADY.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-12-21 12:06:35 +00:00
Andrey Borisovich 7531094050 .github/workflows: zephyr workflow windows-build uploads artifacts
Github allows to store build artifacts for 90 days after the build.
Somebody might want to examine the output of the build, now can
easily download everything that job produces.
In example, compile_commands.json file contains all compilation
commands in verbose that are not visible in the build log
by default.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-12-21 11:46:28 +00:00
Andrey Borisovich f51f296572 .github/workflows: added concurrency group to Zephyr workflow
Recently new feature had been introduced to Github actions
"concurrency" that allows to define a name for a group of workflows
that will cause old workflow to stop if the new one had been created
and the group name matches.
This improves usage of resources in SOF project by cancelling
running workflows when pushes to pull requests are done frequently
before old jobs are completed.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-12-21 11:46:28 +00:00
Andrey Borisovich 30c43c6dff .github/workflows: renamed Zephyr workflow "build" job to "build-linux"
Zephyr workflow had been added new build-windows job.
It makes sense to rename old "build" job yo "build-linux"
for consistency.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-12-21 11:46:28 +00:00
Andrey Borisovich df1ba22230 .github/workflows: added Windows CI job to Zephyr workflow
Added new job to Zephyr workflow running on windows-latest.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-12-21 11:46:28 +00:00
Andrey Borisovich b34cb8bfbb xtensa-build-zephyr.py: change install tree print to ASCII style
During testing of Windows CI workflow on windows-latest turned out
that github action console has issues rendering python
anytree.RenderTree graph with default style of
anytree.render.ContStyle (continuous vertical and horizontal lines).
Tests on local machines in cmd, pwershell and msys shells
proves, that all shells can render the graph (while powershell
does not do this correctly and graph is malformed).
Changing graph style to ASCII resolves the issue with Github actions.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-12-21 11:46:28 +00:00
Guennadi Liakhovetski 96686cfcde ipc: ipc4: do not access memory beyond object boudaries
With IPC4 only two 32-bit values are copied from the host in the
common part, anything beyond that must be copied separately. Those
two values are stored in a global msg_data.msg_in object. Therefore
always when reading from it only up to 8 bytes should be read. In
most cases it is also the case, because the target object has the
same size, but in case of SOF_IPC4_MOD_INIT_INSTANCE this isn't the
case, there special care must be taken.

Also remove a redundant NULL check where NULL cannot appear.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-21 10:13:00 +00:00
Guennadi Liakhovetski 84b2dd2ae9 logger: check localtime() return value
localtime() can return NULL in error cases. Check the return value
before dereferencing it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-21 10:13:00 +00:00
Guennadi Liakhovetski d5e97949a2 selector: avoid array overflow
Check source and sink channels to avoid accessing beyond array
boundaries.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-21 10:13:00 +00:00
Guennadi Liakhovetski 24062b456e volume: fix a potentially uninitialised array
Make sure there's at least one channel in the volume configuration.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-21 10:13:00 +00:00
Guennadi Liakhovetski 0b295ebe96 copier: avoid array overflow
Fix a case of a possible array overflow, detected by static code
analysis.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-21 10:13:00 +00:00
Marc Herbert 2dfaee6a7d logger: convert.c: move global_config->logs_header to the heap
Finish the job that commit 5b29dae9c8 ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
complete, leaving a confusing mix of globals and locals.

This confuses some static analyzer complaining that stack values are
being returned, see #6858 and #6738. This is a false positive because
convert's() stack lifespan is practically the same as a global but let's
simplify things anyway.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-21 09:36:27 +00:00
Marc Herbert 327a26bf8a logger: make "global_config" truly global
Finish the job that commit 5b29dae9c8 ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
finish, leaving behind a supposedly "global" variable that is actually a
confusing global pointer to a struct local to the main() function.

This confuses some static analyzer complaining that stack values are
being returned, see #6858 and #6738. This is a false positive
because the main()'s stack lifespan is the same as a global but let's
simplify things anyway.

Also stop using 'extern' in .c files, use a proper .h file instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-21 09:36:27 +00:00
Kai Vehmanen 80adcdf36a sof-logger: print error if -u uart option is given with no infile
sof-logger -u 115200 -d /lib/firmware/sof-foo.ldc

Leads to silent failure as a NULL is passed to open(). Add
explicit error handling for this case.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-12-20 19:37:17 +02:00
Ranjani Sridharan bf7aa04890 mixout: Convert component to use the module adapter
Convert the mixout module to use the module adapter. The
bind/unbind/get_attribute ops in the mixout module have been moved to the
module_adapter ops and is functionally the same as with the comp_drv
ops.

The struct mixout_data struct has been simplified to contain 2 fields as
the source info table has been moved to struct processing_module and
rename the consumed_yet_not_produced_frames field in struct mixout_data
to pending_frames.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan 847f9fe580 ipc4: handler: initialize hw_params
Initialize the hw_params to 0 before passing it to the individual
components in the pipeline.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan e0458032e2 module_adapter: Fix trigger op for IPC4
The check for status counts for modules with multiple sources is only
applicable for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan fbb82566d2 module_adapter: Fix module_adapter_reset()
When module_reset() returns a non-zero value, print an error if needed
and return immediately.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan ee969eb1b3 module_adapter: Add bind/unbind ops for IPC4
Define the bind/unbind comp driver ops for the module_adapter which will
be used to update the source device pointers in the source_info table.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan 133eecb132 module_adapter: Add APIs for coherent module source info access
Add module_source_info_acquire/release() for coherent access to the
module's source_info data.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Ranjani Sridharan 213d61081d module_adapter: Introduce struct module_source_info
Introduce struct module_source_info that will be used to keep track of
all the source modules that are bound to a module. Also, add a new
field, source_info in struct processing_module to save the source
information for each module.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-12-20 16:44:26 +00:00
Marc Herbert 9b2453e236 xtensa-build-zephyr.py: compress sof-info files in parallel
On my system this brings the install_platform() duration down from about
3 seconds to less than 1 second.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-20 15:44:20 +00:00
Seppo Ingalsuo 9f74088c7c Tools: Topology1: Add to development topologies DRC for UP2 board
This patch adds to development topologies build of minimal topologies
sof-apl-pcm512x-drc.tplg and sof-apl-pcm512x-mdrc.tplg for testing.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-20 15:42:59 +00:00
Kwasowiec, Fabiola 1f374f8840 module_adapter: return success when component state is equal to requested state
When dev->state == requested_state in comp_set_state then
COMP_STATUS_STATE_ALREADY_SET (status 1) is returned.
Then the pipeline trigger is aborted and status 1 is returned
to the pipeline_task_cmd function (status 1 in this function means
PPL_STATUS_PATH_STOP). Finally, the status of the pipeline
does not change and the IPC response returns success.
which causes errors with subsequent changes in the pipeline state
(INVALID_IPC_REQUEST)

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2022-12-20 14:18:36 +00:00
Jaroslaw Stelter 9091635f10 iadk modules: Add variable initialization
This patch adds initialization of module_size_ variable
in SystemAgent() creator.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-12-20 15:27:49 +02:00
Jaroslaw Stelter 4cc849d34b library_manager: Fix dma_ext initialization issue
In the lib_manager_dma_deinit() function proper checks
for dma_ext structure fields must be added to avoid
calling dma api with uninitialized parameters.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-12-20 15:27:49 +02:00
Guennadi Liakhovetski b516172a41 probe: simplify ipc4_get_buffer()
Use a local variable in ipc4_get_buffer() to simplify it and remove
redundant code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-20 14:01:54 +02:00
Guennadi Liakhovetski 40e6c1ddc0 ipc: ipc4: fix an uninitialised variable
This is a theoretical case of an invalid pipeline status, handle it
correctly.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-20 14:01:54 +02:00
Guennadi Liakhovetski 10251c5037 data-blob: fix a NULL dereference
If the main context variable is NULL, it cannot be used to print an
error message. Since this actually should never happen, use an
assertion similar to other similar cases in the file.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-20 14:01:54 +02:00
Guennadi Liakhovetski aff99b209f copier: fix a potentially uninitialised warning
The create_dai() function can return an uninitialised value. Fix it
by reducing the scope of the variable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-20 14:01:54 +02:00
Kai Vehmanen 4bec5b292c logger: exit with error if calloc fails
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after calloc.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-12-20 11:47:01 +02:00
Kai Vehmanen 4d64893b86 sof-logger: exit with error if malloc fails
In user-space tools, memory allocations can reasonably be expected to
always succeed. Make this assumption explicit by adding error handling
after malloc.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-12-20 11:45:34 +02:00
Kwasowiec, Fabiola 19416908dd selector: remove return error when input buffer is 0
A pipeline that contains a selector cannot be run before the pipeline
that is connected to the selector because an error is returned.
The order of the run pipelines should not matter for functionality.

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2022-12-19 20:23:00 +02:00
Serhiy Katsyuba e06e1f0a44 ipc4: copier: remove redundant assignment
Removes variable cd->converter[i] assigning to self. This
fixes error reported by static code analyzer.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-12-19 17:26:07 +00:00
Marc Herbert 4ac3e3ff44 xtensa-build-zephyr.py: don't leave the install of an old build behind
In theory a failure from this script should immediately stop the show
and no one should then use the staging directory.

In practice we cannot make sure, especially not with shell scripts. So
make sure no previous build of a requested platform is left behind.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-19 17:25:28 +00:00
Guennadi Liakhovetski 3b9bc16400 lib-manager: fix cache annotations
lib-manager allocated memory for library modules with a cached alias
and explicitly synchronises cache in it (apparently superfluously).
Add cache address space annotations as needed.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Guennadi Liakhovetski fcd6e9541d alloc: fix argument for cache alias conversion
z_soc_uncached_ptr() takes a cached alias as argument.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Guennadi Liakhovetski eb0c038e96 selector: make frame formats explicitly cached
audio_stream_fmt_conversion() takes cached aliases of frame formats,
fix selector respectively.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Guennadi Liakhovetski 6cdc29472a mixin-mixout: fix address space attribution
src_info, as returned by find_mixout_source_info(), is a part of
mixed_data_info which is explicitly cached. Annotate src_info to be
the same.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Guennadi Liakhovetski 6c4b4ec843 ace: fix cache-uncache conversion macros for sparse
cache_to_uncache() and uncache_to_cache() must be inline functions
with proper argument annotations. Fix ACE definitions by alanogy with
cAVS.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Guennadi Liakhovetski 66a556062a ace: remove "volatile" from cached addresses
Cached addresses aren't used to access the hardware in mailbox.h,
they don't need to be volatile.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-12-19 17:21:53 +00:00
Marc Herbert 2ea4bc0ec4 .github/pull-request.yml: upgrade checkout v2 -> v3
This upgrade was already performed for other jobs in commit
f71eb15818 (".github/workflows: upgrade actions/checkout@v2 -> v3")
and everything went fine. Finish the job and get rid of the last
warnings in the daily tests (example:
https://github.com/thesofproject/sof/actions/runs/3709176785)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-19 16:44:36 +00:00
Pin-chih Lin b581aa52e9 topology: add waves-integrated tplg file for RT1019 codec
Add topology case {WAVES + RT1019 CODEC}

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2022-12-19 16:41:32 +00:00
Seppo Ingalsuo 8d166a432f Audio: Copier: Add missing DMIC DAI index mapping to create_dai()
The dai_index needs to be mapped similarly as in kernel. The SSP
type was handled correctly in the function but not DMIC.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-12-19 14:28:32 +00:00
Chao Song 764ce675ee smart_amp_test: add ipc4 support for smart amp test
Smart amp test module read config from ipc msg and convert ipc4 settings
to ipc3. It is a dummy module used for smart amplifier validation.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-12-19 13:26:19 +02:00