Recent changes increased the size of various sections, breaking
linkage again. We need to make the linker calculate the heap size
automatically but until that is ready, reduce the heap size further
to fix the current breakage.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
As per documentation in include/sof/lib/alloc.h, rmalloc from
MEM_ZONE_SYS will always succeed. In the unlikely case the alloc
fails, trigger a system panic in rmalloc().
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add caching to more heap zones. With addition of SYS, SYS_RUNTIME
and RUNTIME the mapping is now aligned with XTOS allocator.
Signed-off-by: Kai Vehmanen <kai.vehmanen@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>
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>
Currently set to obsolete 0.12.4. Better remove it here for everyone
rather than overriding it in Github Actions only.
Also symlinks the toolchains in /opt to /home to fix autodetection
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
We have change the size of runtime_shared zone to be decided at link
stage, here hardcode HEAP_RUNTIME_SHARED_SIZE to unblock the Zephyr
building.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
COMPILER_WORKAROUND_CACHE_ATTR is also enabled on Zephyr,
but the cache_attr.c file is not compiled since is not added in
zephyr_library_sources.
Without this fix, we get:
cache.h:110: undefined reference to `glb_is_cached'
I've added the file for all platforms since cache_attr.c is generic.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
sof_heap variable is used by all platform, with or
without ENABLE_CACHED_HEAP.
Without this fix, on i.MX with Zephyr we get:
error: 'sof_heap' undeclared (first use in this function);
Fixes: fed69b6a34 ("zephyr: wrapper: disable cached heap on Intel platforms")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Tests with dynamic-pipeline topologies increase the complexity
of alloc/free patterns for heap and these tests have uncovered
new issues with heap corruption. Tests are reporting failed
allocs although heap still has free space. Running same test
with cached heap disabled shows no failures.
The cached heap is already disabled for IMX targets, so build on
this code and add a local ENABLE_CACHED_HEAP define to toggle
the cached heap.
BugLink: https://github.com/thesofproject/sof/issues/4494
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Clean up the ifdefs for ipc_pm_context_save(). By implementing
platform_timer_stop() in the Zephyr wrapper, the original context
save sequence can be used also for Zephyr builds.
By doing this, we can fix issues with IPC timeout on CTX_SAVE.
Disabling all interrupts before the IPC reply is needed also on
Zephyr.
BugLink: https://github.com/thesofproject/sof/issues/4507
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
When the SOF Kconfig is included in other projects, the main menu should
not be that of SOF, rather it should be of the project including SOF.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
In XTOS SOF, ipc_send_queued_msg() is run by task_main_primary_core().
In Zephyr we need to schedule ipc_send_queued_msg() using a notifier
triggered by the periodic ll_scheduler.
This is similar to commit c194125b83 ("zephyr:
add notifier_register(ipc_send_queued_msg) in task_main_start()")
For i.MX we need to use this temporary fix for SOF_SCHEDULE_LL_DMA, also.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
On i.MX the DMA interrupts are routed via IRQ_STEER.
In order for this to work we need to:
- make any second level interrupts handling go
through interrupt-irqsteer.c;
- use first level interrupt handling from
wrapper.c.
TODO: Implement a driver for the IRQ_STEER in Zephyr,
to replace the legacy code (interrupt-irqsteer.c).
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
For now, zephyr_ll is limited to timer_domain.
For i.MX we use dma_domain, so keep the ll_schedule
from SOF, until we extend the zephyr_ll for DMA_IRQ.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Remove zephyr_ll.c from mandatory files for building
SOF with Zephyr and include it where necessary: in CAVS 1.5,
CAVS 1.8, CAVS 2.0 and CAVS 2.5.
While here, add ll_schedule for BROADWELL and BAYTRAIL
when building SOF with Zephyr.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
As of July 2021 we support (too) many tracing options and this
duplication is unfortunately the only way I found to support them all
while giving the compiler the opportunity to optimize away as many
strings as possible.
Supported configurations:
- Systems with limited memory and zero space for full strings, must use
SOF dictionary only.
- Systems with enough space for all strings to be in memory.
- Anything in between
- Support to duplicate only important message to both the DMA and the
mailbox (the default)
- CONFIG_TRACEM: supports duplicating ALL messages to both the DMA and
the mailbox
- CONFIG_TRACEV: supports deleting verbose statements at compile time to
save space
- CONFIG_TRACE: support turning off all traces at compile-time
- SOF dict trace de-duplication a.k.a. "adaptive filtering"
- Dynamic log levels per component
- Redirection to Zephyr's shared memory tracing that requires full strings.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This patch adds to DMIC driver support for binary data based HW
registers setup. The driver mode is selected in Kconfig.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch moves the run-time decimation factors search and filter
coefficients scaling code to separate module as preparation to add
more functionality to the driver. There are no changes to
functionality.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
In preparation for more functionality the module is moved
to own directory similarly as other DAI drivers.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Add URL to documentation for convenience.
Our module name should not depend on the folder name.
Comment out default values to show that we use the defaults.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Commit 34bb9b7282 ("zephyr: wrapper: build SOF with Zephyr for imx")
broke coherent memory allocations on Intel DSP platforms. Restore the
original code.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When building SOF with Zephyr, for i.MX, we get the following
error: undefined reference to `z_xtensa_cache_inv'.
i.MX has only one DSP core, so CONFIG_KERNEL_COHERENCE is not set.
Therefore include arch/xtensa/cache.h, where z_xtensa_cache_inv
is defined and implemented, in cases when the kernel is not built in
a mode where all shared data is placed in uncached memory.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
When building SOF with Zephyr for i.MX the following
additional adjustments, to the wrapper, are required:
1. include heapmem variable in .heap_mem section,
otherwise the HEAP_SIZE is duplicated in two sections and
the sdram0 region overflows;
2. no need to split heap into shared and unshared since
we only have 1 DSP core; In this case, the kernel will
never be built in a mode where all shared data is placed
in multiprocessor-coherent (generally "uncached") memory.
3. use simple interrupt_get_irq() to get the Linux interrupt
and later pass it to irq_steer;
4. use Xtensa timer, as we do now with SOF and XTOS.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Switch SOF under Zephyr to use a simplified native low-latency
scheduler implementation.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Direct access to mbox shared memory logging when DMA tracing is
either not initialized yet or disabled or found broken for any
reason.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fixes#4356
In XTOS SOF, ipc_send_queued_msg() is run by task_main_primary_core(),
the initialization of which has a hard and circular dependency with the
initialization of the EDF scheduler. This EDF scheduler is not part of
Zephyr. Because of the circular dependency it does not seem
possible (nor desirable?) to refactor this code and make it compatible
with Zephyr. So schedule ipc_send_queued_msg() differently in Zephyr:
using a notifier triggered by the periodic Low Latency scheduler.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
To increase performance of audio application code, the SOF heap should
be mapped to cached address region on platforms with aliased
cached/uncached memory layout.
This splits the heap into two and maps the SOF_MEM_ZONE_BUFFER to
the cached heap and all rest to uncached heap.
The raw heap memory area is still mapped to uncached memory, even for
the cached heap. The allocated blocks are converted to cached addresses
and passed to SOF users of rmalloc() and rballoc_align(). To ensure
application buffers do not share cachelines with heap metadata chunks,
allocation sizes are rounded up to integer multiples of platform
cacheline size.
BugLink: https://github.com/thesofproject/sof/issues/4306
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Prepare for supporting new IPC major versions by partitioning
IPC code into directories.
This is a code move only, no code changes except Makefiles.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Commit 8357dcf793 ("zephyr: trace: use zephyr utilities when enabled")
added Zephyr's sys/printk.h in order to fix:
warning: implicit declaration of function 'printk'.
Remove #ifdef __ZEPHYR__ macro since this is not needed, because
the whole file is for Zephyr only.
Fixes: 8357dcf793 ("zephyr: trace: use zephyr utilities when enabled")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Remove redundant ret initialisation in two versions of
schedule_task_init_edf() and in schedule_task_init_ll().
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Use the Zephyr sys/printk.h when Zephyr RTOS is used.
Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Currently the DAI HW configuration is tightly bound to the IPC major
version and IPC structures. Provide a mechanism whereby different
IPC data structures can be passed for DAI configuration.
This change does the following changes.
1) Pass a common ipc_config_dai structure to all dai config call. This
allows retention of common logic that uses this common data.
2) Provide a IPC specific private data pointer to the dai config that
can be interpreted by the DAI as custom data. Today this is the
existing IPC, but it could also support an NHLT binary register blob in
the future.
3) Splits ipc specific code out of src/audio/dai.c and into
src/ipc/ipc3-dai.c.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
timer_domain.c contains a lot of Zephyr- and XTOS-specific code and
relatively little common code. Aplit it into two files instead of
using a large number of #ifdef instructions.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>