test_keyword_get_threshold() can return errors, make sure to check
its return value before using it.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
IPCs from the host aren't very frequent during normal operation, and
having all their codes in firmware trace output is extremely useful
for debugging. Add a trace print for arriving IPCs.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
It is possible, that ipc_complete_cmd() is entered 3 times while
processing a single IPC message in multicore configurations: once by
the primary core, then by the IDC IPC processing context, and finally
by the pipeline thread, actually executing the IPC. To make sure that
the response is only sent once by the core, that actually processes
the IPC, we must not clear the .delayed_response flag on the primary
core in such cases, it should only be done by the IDC IPC context
before the pipeline task actually sends the response.
Fixes: 82857a78ba ("ipc: fix a IPC completion race")
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Buffer allocation has been changed to the runtime_shared
zone. Use cache ptr to do the invalidates/writebacks.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Make sure all pipeline_for_each_comp() return values are
consistently checked.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
atomic_read() returns values of type uint32_t, no need to cast to it
again.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
If the last task completes in a domain, don't re-enable it. It will
be re-enabled when a new task is submitted.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
If the last task in the timer domain is completed, the ll_scheduler
tries to unregister the task from the domain. The timer domain
driver currently tries to unregister the interruptin its
.domain_unregister handler, which then leads to a crash. Avoid
unregistering the handler from itself.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When recursing pipeline components, using pipeline_for_each_comp(),
each component's .comp_func() method is called. Those methods can
return 0 for success, a negative error code or PPL_STATUS_PATH_STOP
if recursing should stop. However, the latter code is ignored by
pipeline_for_each_comp(). Add a check for that code and terminate
recursion if detected.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
pipeline_for_each_comp() and buffer_set_params() can fail, make sure
to check their return values and propagate any errors.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
ipc_free is a function, we should avoid shadowing in the event we tried
to use the function here.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Can't return a negative error if we are returning an unsigned type.
C is great right? No reason to ever use something like rust...
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
We should always have a dev, and even if we didn't we would crash here
because we logged above in debug using dev and we are logging the
error itself using dev.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
cppcheck for some reason doesn't understand that j > 1 has nothing to do
with the indexing itself and this the check is pointless, so switch to
!= so it doesn't flag the issue anymore.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
if we shift 1 left 31 times we will overflow the signed bit. Assuming
the intent is correct lets make this unsigned so cppcheck won't
complain.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
cppcheck pointed out that either our nullpointer check was not needed or
that we are failing to do it before using the pointer. The check looks
valid so lets fix the lookup.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This will be used to stop the trace DMA and free
its resources. This change is tagged for ABI 3.20.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add kconfig item CAVS_IMR_D3_PERSISTENT to denote if IMR restore feature
will be used on an Intel cAVS platform.
It will be disabled by default, please only enable it where IMR content
is persistent when DSP in D3, as enabling it means we don't need to
re-downloading firmware binary to DSP SRAM so fast D3->D0 transition
will be supported.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This reverts commit a398e92f2e.
Schedulers are per-core already, no need to further verify that.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The XTOS allocator aligns non-cachec allocations to the platform
cacheline size. Test results indicate some SOF application code
relies on this behaviour, so align Zephyr's rmalloc implementation
to match the behaviour.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Implement the cached SOF heap zones using a single sys_heap
object.
Compared to old implementation which used two separate sys_heaps,
this implementation enables dynamic cached/uncached partitioning
of the heap.
To ensure coherency of the Zephyr heap operation, if cached heap
is enabled, all allocations must be aligned to dcache linesize.
Add a Kconfig option CONFIG_SOF_ZEPHYR_HEAP_CACHED to turn on/off
the cached heap logic, with default set to no for all platforms.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
The heap code was invalidating blocks on allocation, but that's the
wrong side of the pipe. By definition, new heap memory
will/should/must be written before being used (because the memory is
undefined), so any cached contents are irrelevant as they'll be
overwritten.
But when the user is finished with the block and frees it, there may
still be live dirty cache lines in the region on the current CPU.
Those must be invalidated, otherwise they will be evicted from the
cache at some point in the future, on top of the memory region now
being used for different purposes on another CPU.
Remove the invalidate on allocation. Add it back in free. Leverage a
new Zephyr sys_heap_usable_size() routine to get the size so we don't
have to store it in an extra header.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
When freeing blocks, we need to perform writeback and invalidate to the
dirty cache lines, otherwise, they will be evicted from the cache at
some point in the future, which will break the usage of the same memory
region from another DSP core.
Introduce a free_ptr to make sure the original 'ptr' is not changed, so
we can use it for this wb/inv operation.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Zephyr XCC builds for Apollolake can be re-enabled now after the RAM
footprint has been reduced.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Building SOF with Zephyr for Apollolake with XCC fails because of
insufficient RAM. Reduce the heap size to fix the problem.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Get_large_config is used for driver to query module information
and set_large_config is used to change module config dynamically
Signed-off-by: Rander Wang <rander.wang@intel.com>
The module id of basefw is zero. Driver get & set global
states by this id, such as platform info, memory inf, hw
info, power info.
There are three types of elf binary built by SOF: boot_loader,
basefw which is built from all sof entities selected in kconfig
and external libraries developed by 3rd party and may be close-source.
Rimage packs boot_loader and basefw into sof-xxx.ri.
This patch adds limited support of features in basefw module and more
features will be added in future.
Signed-off-by: Rander Wang <rander.wang@intel.com>
The use of temporary variables in the header was introduced by
commit 1bb78a5cab ("dma: use platform_shared_commit()")
When the platform_shared_commit() use is removed by
commit 580b9cf005 ("memory: remove platform_shared_commit() as it's a NOP on all platforms.")
The temporary variables remained for no reason.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The use of temporary variables in the header was introduced by
commit 1bb78a5cab ("dma: use platform_shared_commit()")
When the platform_shared_commit() use is removed by
commit 580b9cf005 ("memory: remove platform_shared_commit() as it's a NOP on all platforms.")
The temporary variables remained for no reason.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Remove the 'ret' variable from hda_dma_release() and
hda_dma_get_attribute() as there is no need for them.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Add support for max98360a running on ADL boards. We choose SSP1 for
speaker amplifier for BT offload compatibility. Also increase the
sample depth to 32 bits for more dynamic range and avoid using m/n
counter.
We add the flag SSP_CC_BCLK_ES to SSP0 for the compatibility with
CS42L42 in the future.
Signed-off-by: Brent Lu <brent.lu@intel.com>
Preserve the top-level dependency on run_smex (through
copy_dictionaries) so dictionaries are still built by default when
CONFIG_TRACE is true.
Fixes commit dad6b192f6 ("cmake: fix smex dependencies"). That commit
successfully removed the dependency when CONFIG_TRACE is false but it
didn't go far enough: run_rimage is _never_ dependent on run_smex.
This means dictionaries can now be built in parallel.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
rimage and smex don't depend on disassembly. Nothing does yet this adds
sof_dump as a top-level, 'bin' dependency so "make bin" still builds it
and so this commit does not cause any interface change.
This makes it possible to disassemble in parallel with the end of the
build.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
No build target should ever change files in place. This causes subtle
and time-consuming issues:
- The most obvious, logical issue is making incremental builds
impossible: if the build stops at the "in-place" step for any reason
then the build system does not know where to resume.
- When working on the build system itself, the file
`build/src/arch/xtensa/sof-platf` after `make `prepare_sof_post_process`
is different from the one after `make sof_post_process` which is
confusing and time-consuming.
- Additional confusion in this case (not addressed by this commit): the
final build/sof.ri is NOT generated from build/sof but from
build/src/arch/xtensa/sof-platf instead.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The host will receive an error if it tries to re-configure the dtrace:
[ 22736132.117381] ( 28.645832) c0 hda-dma ..../intel/hda/hda-dma.c:489 ERROR hda-dmac: 4 no free channel 0
[ 22736147.377797] ( 15.260416) c0 dma-copy src/ipc/dma-copy.c:163 ERROR dma_copy_set_stream_tag(): dc->chan is NULL
[ 22736180.346545] ( 32.968750) c0 ipc src/ipc/ipc3/handler.c:805 ERROR ipc: failed to enable trace -22
Since we try to request an already used channel. If we skip the requesting
then we will fail with the configuration:
[ 31707957.542122] ( 27.447916) c0 dma-copy src/ipc/dma-copy.c:162 ERROR dma_copy_set_stream_tag(): already have chan for stream_tag 1
[ 31708021.917120] ( 64.375000) c0 hda-dma ..../intel/hda/hda-dma.c:539 ERROR hda-dmac: 4 channel 0 busy. dgcs 0x800000 status 5
[ 31708056.083785] ( 34.166664) c0 ipc src/ipc/ipc3/handler.c:805 ERROR ipc: failed to enable trace -16
To support the reconfiguration:
if we have DMA channel for dtrace, stop it to allow the reconfiguration.
In the unlikely case when the stream_id has changed, release the channel
as well and request a new one.
Tested with the SOF client kernel by rmmod and modprobe the dtrace client
during active audio playback to prevent the DSP to be turned off.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
After the dma_copy_set_stream_tag() a DMA channel is requested, release it
in any of the error cases later.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Use %p so the higher 32 bits are not quietly lost if dma_base ever
becomes 64 bits.
Fixes commit be69f41bef ("drivers: imx: sdma: fix warning")
Issue found by chance in unrelated PR #4837
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Add m4 and headers to support basic topology with passthrough
pipeline for ACPSP and DMIC use cases support on renoir platform.
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: balapati <balakishore.pati@amd.com>
Host DMA is never paused/released. So, remove the pause
and release ops from the host DMA ops.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Host DMA is never paused or released. Remove the code to
start host DMA during release and the check for release
in hda_dma_host_start().
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
So, leave this bit untouched for link DMA and only set/clear it
for the host DMA for both playback and capture.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>