Reduce complexity by parsing all topology objects in memory rather than
by seeking file, reading into allocated memory and then freeing memory.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The original fuzzer has been deprecated for some time now. Remove it.
All fuzzing now done by OSS-fuzz
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Fixes recent commit 8aab18351f ("xtensa-build-zephyr: fix
DEFAULT_TOOLCHAIN_VARIANT spill on next platf")
Some XtensaTools installation are missing this `default-params` symbolic
link:
```
XtensaTools/config/
|-- X4H3I16w2D48w3a_2017_8-params
|-- X6H3CNL_2017_8-params
|-- cavs2x_LX6HiFi3_2017_8-params
`-- default-params -> cavs2x_LX6HiFi3_2017_8-params
```
Maybe it's missing when installing with the graphical interface?
This symbolic link is surprisingly enough to make `xt-objcopy` work
_without_ the XTENSA_ variables. But when the variables _and_ the link
are both missing, then `xt-objcopy` fails with the usual error:
```
in current dir: work/current/sof; running command:
XtDevTools/install/tools/RG-2017.8-linux/XtensaTools/bin/xt-objcopy
--remove-section .comment sof/build-tgl/zephyr/zephyr.strip
build-sof-staging/sof-info/tgl/stripped-zephyr.elf
Error: there is no Xtensa core registered as the default.
You need to either specify the name of a registered Xtensa core (with
the --xtensa-core option or the XTENSA_CORE environment variable) or
specify a different registry of Xtensa cores (with the --xtensa-system
option or the XTENSA_SYSTEM environment variable).
The following Xtensa cores are available:
hifiep_bd5
cavs2x_LX6HiFi3_2017_8
sample_config
sample_flix
...
```
Fix this failure by simply passing the XTENSA_ variables to xt-objcopy.
Kudos to Seppo Ingalsuo for the interactive debugging session that
allowed root-causing this problem extremely quickly.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
If the max_block_count attribute is zero, this may lead to
division by zero error. Handle this explicitly but reporting
error if max_block_count is zero.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Volume has multiple data arrays sized to SOF_IPC_MAX_CHANNELS
and code that uses these arrays without bounds checks (like
volume_ramp()).
Add a sanity check to volume_prepare() to ensure channels
count is never set to a higher value.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Current code may end up dereferencing null pointers in case
memory allocations fail in ams_init(). Handle this with proper
error handling.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit prevents DP modueles from run on different cores than
the pipleine LL modules. This limitation is enforced because of
possible cache races in pipeline_for_each_comp()
To be removed till safe implementation is ready
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Pipeline creation
- create a task for each DP module when started
on primary or secondary core
- delete a task for each DP module when stopped
- don't call comp_copy in LL context for DP modules
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
A component need to keep an information about how it need to be
scheduled - as LowLatency or DataProcessing. The information comes
from IPC4 init instance message
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
The DP scheduler is a scheduler based on Zephyr preemptible
threads. It will start each SOF task as a separate Zephyr
thread.
At current implementation the scheduler can trigger each
task/thread periodically or on demand.
TODO: more sophisticated scheduling decisions, with deadline
and task budgets calculations.
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
some platforms don't use Zephyr, therefore they can't
use DP scheduler. Add a config option
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
The CMakeList.txt files in tools/topology/ have always confused two
different things:
- the list of .tplg files to generate, and
- the CMake logic used to invoke alsatplg and generate them.
Separate the two at last thanks a dead-simple `include()` command. If I
had knew it was so easy I would have done this much sooner.
The `tools/build_tools/` directory is identical before versus after this
commit.
This will make it much faster to identify what actually changes in
future commits and pull requests. This will also make CODEOWNERS
smarter and reduce Github notification noise.
Don't do it for topology1 to minimize churn and git disruption in
backports. Topology1 is not very active any more whereas topology2 has
never been released yet.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Decompose the split in the next commit into two steps to maximize git's
similarity index and facilitate git blame, cherry-pick/rebase, merge,
etc.
The new files are unused in this first commit so git bisect is not
affected.
Changing one-character in the source files also helps: compare git show
-C with git show -C -C. It's also a good clue for the reader when not
using -C.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
In case one of the sources is inactive, the avail_frames
for that source is 0 and the frames = 0.
So, later on, there is nothing to copy, even if, at least
one source is still active.
In this case, we get a "write error: Input/output error".
To fix this, allow mixer to process data from at least one
source, if that is active.
Or, in other words, if any source is inactive, skip it.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
The config to get for smart_amp_test module is
struct sof_smart_amp_config, instead of the bigger
wrapper struct smart_amp_data, so the config size
should be the size of struct sof_smart_amp_config.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
We use zero-size arrays throughout the code in place of flexible
arrays. There are only two cases where flexible arrays cannot be
used: inside unions and where such an array is the only member of the
structure. In all other cases we can switch to flexible arrays to let
the compiler warn us of any improper use.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
struct ipc4_module_init_instance contains 4 structures at the end,
that aren't currently used in the firmware. Some of them like
struct ipc4_module_init_ext_data have a flexible array at the end
but can have further structures following them. Remove these
structures until any of them are needed, at which point they can be
re-added with proper size accounting.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
xtensa-build-zephyr.py has always defined XTENSA_ and other environment
variables in the current environment shared by all platforms. This was
always bad but apparently never a problem until the addition of the new
DEFAULT_TOOLCHAIN_VARIANT (xcc or clang) variable.
Before DEFAULT_TOOLCHAIN_VARIANT, each platform's environment would
simply override the previous one. However with the new
DEFAULT_TOOLCHAIN_VARIANT, the current environment has precedence for
more flexibility. This makes each platform "spill" onto the next one and
`xtensa-build-zephyr.py -p tgl mtl` fail like this:
```
-- Board: intel_adsp_ace15_mtpm
-- Found toolchain: xcc (/home/XCC/install/tools)
CMake Error at zephyr/cmake/compiler/xcc/generic.cmake:9 (message):
Zephyr was unable to find the toolchain. Is the environment
misconfigured?
User-configuration:
ZEPHYR_TOOLCHAIN_VARIANT: xcc
Internal variables:
CROSS_COMPILE:
/home/XCC/install/tools/RI-2022.10-linux/XtensaTools/bin/xt-
```
To fix this, stop modifying the current os.environ and use a new, fresh
os.environ.copy() for each platform instead.
Fixes commit 309fa264e2 ("xtensa-build-zephyr.py: upgraded Xtensa
toolchain for MTL")
History repeats itself: commit 6bedd8e742 ("xtensa-build-zephyr: fix
RIMAGE_KEY when building multiple platforms") fixed the same logical
error months ago in a different script.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The simple {0} is not accepted by xt-xcc compiler. It gives
"warning: missing braces around initializer".
Adding sufficient number of braces to match the struct definition
fixes the build.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Add a second level of mixin-mixout mixing and a PCM to the nocodec
topology.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add HiFi4 implementation of dcblock processing functions.
Compared with generic C version, the 16 bit format can save
about 54.8% cycles, and 53.1% for 24 bit format and 49.1%
for 32 bit.
Signed-off-by: Andrula Song <andrula.song@intel.com>
If a component doesn't implement .get_attribute(),
pipeline_get_dai_comp_latency() will divide by uninitialised values,
possibly zero. To fix that initialise those fields to 0 and check
that they have been changed to non-zero before division.
Suggested-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
In component's .get_total_data_processed() method the "input"
parameter means "calculate the direction where I am input." I.e. if
it's true, the method should return processed data on its output, and
if false - on its input. Since the host has only one direction, it
should only return data when the direction matches, i.e. when input
== true for playback and false for capture. The current
implementation has that check inverted. Fix both Zephyr and legacy
versions.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
copier_comp_trigger() calls pipeline_get_dai_comp_latency() for
playback pipelines to obtain the pipeline DAI copier, if there is
one, and to calculate the pipeline latency. The latency is
calculated using the .get_total_data_processed() component
operation, but that operation is only available for DAI, host and
copier components. SOF pipelines often have other components at one
of the pipeline ends, so the latency calculation fails. However, that
shouldn't prevent pipeline_get_dai_comp_latency() from finding the
DAI component.
This fixes the notorious "failed to find dai comp or sink pipeline
not running." error message.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This patch converts the demux_copy, mux_copy, and
mux_get_processing_function tests to module adapter API.
The main change is in component new preparations with
UUID reference.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch simplifies functions mux_prepare_actitive_look_up() and
demux_prepare_active_look_up().
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch converts the components from legacy interface to
module adapter.
The binary control is also changed to use model handler.
The config is changed to be a pointer instead of a struct
inside component data.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Some modules have multiple types and init()s, support this with
unique names per type.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch saves about 15% of processing time or about 0.9 MCPS
during volume ramp.
The volume_ramp() functions are inlined to volume_process() function.
The other use of function in idle is replaced by volume_ramp_check().
In ramp calculation the division in ramp time calculation is
converted to faster multiplication with inverse of sample rate.
The unnecessary checks for vol greater than vol_max or vol_min are
eliminated by ensuring that tvolume[] is limited to vol_min and vol_max.
The clear of ramp_coef[] at ramp finish is unnecessary. It's
internal for linear ramp and is not used by the other ramp type.
The other optimization is to pass to ramp math functions struct
vol_data pointer instead of processing_module pointer to direct
access to needed state variables.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Pull in following rimage changes:
d32db50 mtl: add Aria module to extended manifest
5bc2010 rimage: fix build error
35bc644 mtl: add eq-iir and fir support
6fad356 rimage: Removed hash context from image structure
6c7a151 hash: Remove old hash functions
d258ea2 manifest: pkcs1_5: Use new hash functions
2bd8be3 hash: New hash functions
93c5e8b misc_utils: Move byte_swap function to new misc_utils.c file
9ce1cc8 ext_manifest: Fix fw_ext_man_cavs_header version
a4ca53c toml_utils: Adding support for decimal numbers in hex parser
5ebbd65 rimage: use hex number
36c0c90 elf: Use the get_file_size function
98c7f7b manifest: Use the get_file_size function
6a64cb9 file_utils: Add a new get_file_size function
055ea7e file_utils: manifest: ext_manifest: Add new create_file_name function
fed69d4 toml_utils: adsp_config: Moved generic parser functions to toml_utils
0931d9c main: heap_adsp release fix
3aa199f config: mtl: set init_config for micsel
d48ad6b adsp_config: add dump for init_config
ffd0542 adsp_config: make the default value zero for init_config
cb9c880 config: tgl-cavs: add kpb, selector and kd support
bf23b5e config: mtl: set KDTEST module_type to 8
Signed-off-by: Keqiao Zhang <keqiao.zhang@intel.com>
Remove all support for cAVS 2.0 platformsm including Ice Lake and
Jasper Lake, they aren't supported any more.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
select_cpu_clock() on cAVS currently takes all the clock locks while
adjusting them. And that function is called from clock_set_freq()
which also takes one of those locks, which leads to a recursive
spin-lock. To fix that remove per-clock spin-locks and use a global
clock lock instead.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
We are always returning 0 if the dai_copier is not found and never an error
code. Make it clear by returning 0.
With that out of the way, it is clear that this is not an error, it is
something which can happen.
Firmware log is a proof of that since it is flooded with
<err> copier: comp:X 0xSOMEHEX failed to find dai comp or sink pipeline not running.
prints. Drop the log level to info and add a comment as explanation.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
With previous commits, copier can perform DMA copy without host
endpoint buffer and host device, so remove host device and endpoint buffer
creation, accordinlgy, related state settings are all removed.
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Replace params and copy host dev with copier dev, after this change,
host dev and endpoint buffer are no longer useful for copier, next
step can remove host device and its endpoint buffer.
Simplified host_zephyr_params parameters, since all parameters changed
to copier dev aligned.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Current host dma call back register on host device,
With this optimization, move this call back function from host
to copier device, create a new copier_dma_cb for copier usage.
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Create and expose a couple of functions for host DMA copy
along with struct host_data,these functions will be shared by both
host and copier component.
This is in preparation to remove the creation of a host component and
endpoint buffer in create_host().
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>