ubsan found the following bug via oss-fuzz
/src/sof/src/ipc/handler.c:1385:9: runtime error: left shift of 15 by 28 places cannot be represented in type 'int'
This is caused by SOF_GLB_TYPE_MASK which has an implicit length of 15
(int16_t)
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Any generated file should be tracked by git to keep repositiry clean.
Such an file should be added to .gitignore to reduce possibility of
accidentally pushig this file to remote branches, eg. after typing
`git add *` before pushing changes.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This file is generate by checkpatch run, any temporary file shouldn't
be tracked by git. It was added to git by:
538eb6a: ("host: stub about required functions")
Moreover file is problematic for developers working on Windows,
now try to pull changes from remote repository ends up with:
$ git pull
error: invalid path '.checkpatch-camelcase.git.'
Updating 6e85152..7709924`
cloning repository ends up with:
$ git clone https://github.com/thesofproject/sof.git
Cloning into 'sof'...
remote: Enumerating objects: 97, done.
remote: Counting objects: 100% (97/97), done.
remote: Compressing objects: 100% (96/96), done.
remote: Total 67251 (delta 49), reused 4 (delta 1), pack-reused 67154
Receiving objects: 100% (67251/67251), 13.41 MiB | 2.62 MiB/s, done.
Resolving deltas: 100% (49768/49768), done.
error: invalid path '.checkpatch-camelcase.git.'
fatal: unable to checkout working tree
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
It should be replaced with new SOF_MEM_ZONE_RUNTIME_SHARED
for memory which will need free and SOF_MEM_ZONE_SYS_SHARED
elsewhere.
This commit removes old way of defining allocating shared
memory region and in new way, platform_rfree_prepare()
doesn't need to translate address for cavs platform,
because runtime shared heap is defined on uncashed memory
region internally.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Shared memory shouldn't be connected with any cpu core,
because in general such an resource may be shared between
any number of arbitrary chosen cores.
Connecting it with with core 0 heap, leads to unbalanced
heap usage between core 0 and secondary cores.
Moreover operations like alloc and free may be called from
two different cores, what's not possible in current implementation.
Such an situation is especially possibly during handling resources
describing hardware components, eg. DAI or DMA, from two different
cores.
Moving shared memory management to dedicated heap, allows to easily
use another memory region, what may be needed to fulfill platform
specific demands.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Extract common part to internal function, to allow easily add
new heap in future and remove code duplication.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This allows to reuse this functions for another heaps.
Moreover it helps to omit double memmap committing,
because each client of this function already use memmap,
so is oblidged to call platform_shared_commit().
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This modification allows parameter write at runtime.
Same modificatino was added to smart_amp_test.c
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Propley handle buffer data invalidation and writeback.
This is importnat to keep data synchronized.
Took modification from smart_amp_test.c
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
frame_fmt for feedback was hardcoded to S32_LE format.
This workarround code is no longer needed.
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Use 'comp_get_state' function to read state instead of
doing directly access to state member viariable.
Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
There is no place for unused arguments, their are consequence of invalid
argument list as usual.
Such an situation is highly possible especially during defining trace
filters, eg `-Fv=mux 4.1` instead `-F"v=mux 4.1"` or `-Fv=mux4.1`.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
TE/RE bit will remain set until the end of current frame. So,
for example, even if we set TE to 0 the transmitter will still be
enabled until the end of current frame.
This can have unexpected results when quickly restarting a channel.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
The topology has two speaker amp configured, with voltage info
feedback-ed to host for each channel in the EchoRef, so update
SMART_REF_CH_NUM accordingly.
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
The handler is the primary entry point for the fuzzer and therefore
needs to be added to the build.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Many functions are needed for building that are not relevant to the
platform. Stub these out so the system can be fuzzed correctly.
Also fix up a misisng header
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
oss-fuzz does not support dynamic linking, therefore we need to add
support for static builds
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
In order to get proper perf counters peaks values
we should cast arch timer value to uint32_t.
Arch timers API allows user to get uint64_t value.
In fact arch timer consits two parts. 32 bits (MSB)
software part and 32 bits (LSB) hardware timer.
The 32 bits (MSB) software part is incremented only
during hardware timer rollover when timer interrupts
are enabled. If interrupts are not enabled (perf_cnt
case), incrementation will never appear.
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
Following commit 88b69cc2e5 ("scripts: xtensa-build-all: Add support
for building TGL and signing with MEU") we now have an unified and
flexible PRIVATE_KEY_OPTION that can do anything with very little code.
The -k option was never a good idea in the first place because it
already required an environment variable anyway (RIMAGE_PRIVATE_KEY)
instead of a command line argument so the code should have just checked
whether RIMAGE_PRIVATE_KEY was defined, that would have been
enough. Requiring the user to "double-confirm" with -k has been adding
extra complication for both the user interface and the implementation.
xtensa-build-all is effectively a "CMake configuration convenience"
script, however it shouldn't become an additional layer of indirection
and complexity and its interface should expose CMake (which is already a
layer of indirection!) as directly as possible.
See longer discussion in PR #3187
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
In case when new timeout requires timer rollover
we should set ccompare value to 1 in order to
increment timer->hitime properly in timer_64_handler().
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
Possible null pointer dereference was possible here.
There is no need to log error message here, it's done
from trace_filter_ipc_comp_context() and ipc_trace_filter_update().
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
As per component graph we start devices in INIT state. Since most
components don't use this state anyways lets just init the struct to
this state and remove it where it is used correctly.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Instead of specifying the default core count for each Xtensa DSP
architecture set it globally to the available maximum core count.
The user can still reduce the number to save power.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
It's not obvious that icd refers to pipeline scheduling component,
so added this information to log message. By the way, scheduling
component id has been printed.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Volume and switch controls in the dmic pipeline need different channel
maps based on dmic channel count. This will enable the control of all
channel volumes and mutes from user space.
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
Add a new CONFIG_MAX_CORE_COUNT, set it automatically, depending on
the platform and use it to limit CONFIG_CORE_COUNT.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
PLATFORM_CORE_COUNT is always defined to be equal to
CONFIG_CORE_COUNT except when CONFIG_LIBRARY is set. This patch
removes this redundancy, uses CONFIG_CORE_COUNT directly everywhere
and limits it to 1 for CONFIG_LIBRARY and for Zephyr builds.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This information is already provided by extended manifest,
so there is no need to double it in runtime code.
It allows to save 16 bytes from .DATA and 128 bytes from .TEXT
for cnl platform.
`data_structs` library from src/ipc/CMakeLists.txt is no longer
needed. Moreover empty library may lead to cmake fail.
SMEX needs little update, to read DBG_ABI from .fw_metadata section
instead of .fw_ready.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This information is already provided by extended manifest,
so there is no need to double it in runtime code.
It allows to save 400 bytes from data .DATA and 64 bytes from .TEXT
for cnl platform.
EXT_MAP_PORT() macro is no longer needed.
Created __unused macro in compiler_attributes.h as compiler
attributes shouldn't be used directly, to allow easy compiler change.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This information is already provided by extended manifest,
so there is no need to double it in runtime code.
It allows to save 28 bytes from .DATA and 128 bytes from .TEXT
for cnl platform.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This information is already provided by extended manifest,
so there is no need to double it in runtime code.
It allows to save 92 bytes from .DATA and 128 bytes from .TEXT
for cnl platform.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>