Commit Graph

6647 Commits

Author SHA1 Message Date
Iuliana Prodan 7d2f621f36 zephyr: imx: use zephyr utilities when enabled
Use the Zephyr sys/util.h when Zephyr RTOS is used.

While here, remove sof/lib/cpu.h which is not used.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 4e8743f76f zephyr: imx: split initialization
Zephyr already uses main() and has already performed
a lot of initialization before entering SOF.
Split initialization, for i.MX platforms, to make sure
no operation is repeated.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Iuliana Prodan 894f28fbda zephyr: build: add initial support for imx
Build SOF with Zephyr for i.MX platforms.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-07-06 14:22:37 +03:00
Marcin Rajwa e05fbff7c6 codec_adapter: cadence: get init_done status on prepare
This patch adds init_done status check at the very end of
cadence_codec_prepare() function. This is needed to know if
codec is fully prepared for the processing or not. Note we don't
do anything with the value read at prepare, we postpone final
verification until copy/process time since some codec variants
require input in order to finish its initialization.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa fcb93569f0 codec_adapter: cadence: change reset procedure
This patch simplifies reset procedure of cadence codecs
by only calling the init_process() function in which
XA_CMD_TYPE_INIT_PROCESS is the API call responsible for
the actual reset of codec parameters.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa efe26a26c1 codec_adapter: generic: simplify reset procedure
After the reset codec should not need to be prepared again.
We want reset procedure to just set all the parameters to their
default values.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Marcin Rajwa d2b188e4c1 codec_adapter: generic: fix comments
This patch fixes wrong comment in generic processing function.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-07-06 11:17:51 +03:00
Guennadi Liakhovetski a439ea93f6 zephyr: ll-schedule: switch over to a simplified implementation
Switch SOF under Zephyr to use a simplified native low-latency
scheduler implementation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski 83f86defa4 zephyr: ll-domain: make semaphore per-core
Currently a global semaphore is used to signal all schedulers on all
cores, waiting for the next timer period. A more reliable solution is
using a per-core semaphore. This patch switched over to that
approach.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski a1c5183aa9 zephyr: ll_schedule: support no-return in domain_unregister()
Under Zephyr LL scheduling is implemented by per-core threads. They
are spawned when the first task on that core is scheduled. When the
last task on that core is completed, the thread is terminated, which
can happen in context of that very thread. This patch adapts the
generic LL scheduler code and the Zephyr LL domain scheduler for
that by making sure to call thread termination in a consistent state.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski d2409a233d zephyr: ll-domain: stay within the zephyr_* namespace
zephyr_domain.c is a drop-in replacement for timer_domain.c. To avoid
modifying initialisation code we used the same timer_domain_init()
name for its initialisation function. However, the rest of the file
uses the zephyr_domain_* namespace. Rename the function to stay
within the same namespace and use a macro to redirect the call.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski 91a5e63d47 zephyr: ll-domain: update .next_tick on each timer interrupt
.next_tick has to be initialised at domain registration and updated
on each scheduling domain event.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski a971f85c1a zephyr: ll-domain: fix domain unregistration
When the .domain_unregister() method is called, .total_num_tasks is
still positive, it will only become 0 for the last task after
.domain_unregister() returns. When cleaning up also set the user
pointer to NULL.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Guennadi Liakhovetski f9e07679b9 schedule: remove an unused "period" parameter
When registering scheduling domains period is never used, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-02 14:10:30 +01:00
Pierre-Louis Bossart a0f789dfc6 topology: cavs-nocodec: temporarily fix jsl-nocodec issues with s24le
For some reason s32le does not work for DAI definitions on JSL-NOCODEC
platforms. alsa-bat tests fail, but they work fine on APL, CNL,
TGL. This is likely to be an ICL platform issue. The root cause is
still TBD

Use s24le for now to unlock Intel daily tests.
All other platforms remain with s32le.

BugLink: https://github.com/thesofproject/sof/issues/4427
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-07-01 13:31:57 -05:00
Ranjani Sridharan e1b1fed3b2 Revert "pipeline/buffer: alloc them in the runtime shared zone"
Revert these for now. Will be fixed with other multi-core fixes.

This reverts commit 928dba0853.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-07-01 12:24:15 +01:00
Kai Vehmanen db36db4778 cavs: memory: unify access macros on Zephyr
With Zephyr linker scripts updated on all cAVS platforms, we can now
unify uncache_to_cache() and cached_to_uncache() implementation in
Zephyr builds.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-30 19:14:47 +01:00
Marc Herbert 02c21c25ba dma-trace.c: use new mtrace_printf() to demote FW ABI banner to INFO
... down from ERROR. It was never an error, this was a hack to be
duplicated to both trace and etrace. This will make it easier to search
for actual errors.

Also make the banners slightly different between etrace and trace thanks
to new SHM: and DMA: prefixes. This makes identification of log files
easier.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 1a7c0056a2 dma-trace.c: use new mtrace_printf() to add some error handling
Replace some tr_err() too.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 50eb5c9ca2 trace.c: add mtrace_printf() low-level shortcut
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>
2021-06-29 23:11:41 +01:00
Marc Herbert 532642bb32 timer.h: add platform_safe_get_time(timer) and use it in trace.c
Returns a small constant instead of crashing platform_timer_get() when
timer is NULL.

This is required to restore early tracing before sof->timer is
initialized.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert 3674c0f113 trace.c: mtrace_event: fix memcpy_s( dest_size ) argument
Found by chance while looking for something else.

This makes no difference right now because we checked the "length" in
the line immediately before but let's do the right thing anyway, at the
very least it's more readable.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Marc Herbert a0743971c9 check patch: turn off printk warnings
Zephyr's printk does not work like Linuxs printk

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:11:41 +01:00
Li-Yu Yu 0c21218b37 comp: Free model_handler in error paths during create
Add matching comp_data_blob_handler_free calls for
comp_data_blob_handler_new in error paths, which are
missing in many components' "new" functions.

Signed-off-by: Li-Yu Yu <aaronyu@google.com>
2021-06-29 23:05:42 +01:00
Marc Herbert c194125b83 zephyr: add notifier_register(ipc_send_queued_msg) in task_main_start()
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>
2021-06-29 23:04:04 +01:00
Marc Herbert cf3a7d1604 notifier.h: document the API
... and rename some parameter names.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 23:04:04 +01:00
Zhang Keqiao 130bffa6a9 topology: add tgl-h nocodec topology build
add the TGL-H nocodec topology for zephyr test.

Signed-off-by: Zhang Keqiao <keqiao.zhang@intel.com>
2021-06-29 22:51:10 +01:00
Kai Vehmanen 8633d5fd6d cavs: pm: improve PM_RUNTIME_HOST_DMA_L1 documentation
Reword doxygen comments and change the private helper function
names to better reflect the actual implementation. No functional
change.

The PM_RUNTIME_HOST_DMA_L1 resource is used to coordinate host DMA
users, so that DMI link is kept in L1 until all users are ready to
activate the link. This is a bit unusual usage of runtime-pm interface
in that a 'put on a resource' triggers transition to higher power state,
so this deserves some more documentation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-29 22:49:50 +01:00
Brent Lu 8c863f43af topology: sof-glk-cs42l42: using 24-bit sample depth on SSP2
Changing sample depth of SSP2 to 24 bits for better dynamic range.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-06-29 22:41:08 +01:00
Liam Girdwood eb7add5135 testbench: add a option for specifying the number of copy() iterations
All the user to specify the number of copies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood b8d6760600 testbench: fix crash when file has no . extension
Testbench crashed when a in/out file has not . extension. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 305223a1f6 testbench: free components and pipeline after test results.
Move the comp free to after the results and free the pipeline.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 777c0008c1 testbench: add more helpful output for options parsing.
Lets be more helpful to the user.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood bc10ba8b76 testbench: squash some valgrind warnings.
Buffer and params not initialised to zero like the other IPC structures
used by testbench. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:58 +01:00
Liam Girdwood 1ab68bfc00 mocks: enable allocator tests in host mocks with valgrind
This enables support for running the allocator mocks with valgrind by
building the allocator for the host library target using a similar
heap map to Intel CAVS targets (memory.c is almost identical copy of CAVS
version).

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:02 +01:00
Liam Girdwood c1f0f7068e pipeline: add heap trace to pipeline_new()
Balance the heap status with the existing pipeline_free() heap debug.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-29 11:05:02 +01:00
Marc Herbert 24a6159cb2 apollolake/memory.h: sort regions table comment by address
This makes it possible to match the table with the definitions.

Pure comment change, no code change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-29 09:25:19 +01:00
Ranjani Sridharan 6bbf6b0d3c Revert "dai: only process DAI config for comps on cores that enabled"
If the core is not up, the comp exist in the comp_list.
So no need to check if the core is up.
This reverts commit bccecb1a8e.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-28 20:45:35 +01:00
Kai Vehmanen 985c5b5685 zephyr: split the heap into shared and non shared
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>
2021-06-28 20:07:02 +01:00
Ranjani Sridharan b91818be32 drivers: intel: dmic: fix double free dmic_remove()
Disable dmic interrupts first followed freeing by the dmic task
and finally, free the dmic pdata.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-28 19:59:12 +01:00
Liam Girdwood 0cf1f88546 buffer: fix double list deletion detected by valgrind.
Buffer lists were being deleted twice, at first by the
pipeline_disconnect() (the correct place) and then by buffer_free().

Fix this so buffer_free() only frees the buffer.

==426365== Invalid write of size 8
==426365==    at 0x49CB47B: list_item_del (list.h:57)
==426365==    by 0x49CB47B: buffer_free (buffer.c:179)
==426365==    by 0x49C8C7B: ipc_buffer_free (helper.c:697)
==426365==    by 0x10C1E6: free_comps (testbench.c:165)
==426365==    by 0x10C1E6: main (testbench.c:415)
==426365==  Address 0x4bdce48 is 152 bytes inside a block of size 168 free'd
==426365==    at 0x484521F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==426365==    by 0x49C9163: comp_free (component_ext.h:55)
==426365==    by 0x49C9163: ipc_comp_free (helper.c:866)
==426365==    by 0x10C200: free_comps (testbench.c:162)
==426365==    by 0x10C200: main (testbench.c:415)
==426365==  Block was alloc'd at
==426365==    at 0x4847A25: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==426365==    by 0x10D4E8: comp_alloc (component.h:548)
==426365==    by 0x10D4E8: file_new (file.c:430)
==426365==    by 0x49C81E7: comp_new (helper.c:423)
==426365==    by 0x49C8F0F: ipc_comp_new (helper.c:823)
==426365==    by 0x10E642: load_fileread (topology.c:323)
==426365==    by 0x49E13A0: load_widget (tplg_parser.c:1281)
==426365==    by 0x10F796: parse_topology (topology.c:779)
==426365==    by 0x10BE76: main (testbench.c:310)

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-28 09:11:34 +01:00
Ranjani Sridharan bccecb1a8e dai: only process DAI config for comps on cores that enabled
DAI config IPC is propagated to all DAI comps scheduled on
all cores but it should only be done if the secondary core is
enabled.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Ranjani Sridharan 928dba0853 pipeline/buffer: alloc them in the runtime shared zone
Make them shared between cores as they can be shared with
other pipelines, trace and possibly even DMA.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Ranjani Sridharan 29f0aeb913 arch: extensa: cpu: reset stale trace point during power down
When a secondary core is disabled and re-enabled without a
D3 cycle, the POWER_UP IDC message end up reading the trace
point message from the first boot. Reset it during power down
to avoid this.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Ranjani Sridharan 7b06921b6b pipeline_graph: no need to free pipeline components during pipeline_free()
Pipeline components will be freed by the host before the
pipeline widget itself is freed. No need to walk the pipeline
and free anything during pipeline_free().
Fix the unit tests to remove the tests that are not relevant anymore.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Ranjani Sridharan 299fe20d80 schedule: edf/ll: remove list del/init during schedule free
edf_sh->list is not an item. So calling list_itel_del()
on it is wrong in scheduler_free_edf().

remove list_init() from scheduler_free_edf() as the list
should already be free and initialized.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Ranjani Sridharan da79c5073b ipc: ipc3: handler: fix error handling for pm_core_enable
Check and return error if enabling a core fails instead
of overwriting the error with a subsequent successful
core power up.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-27 20:15:44 +01:00
Curtis Malainey c4666dc27d OWNERS: replace dgried with chiang831
Dylan is transitioning, replace his spot with Jimmy for FYI on PRs.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-06-26 13:13:11 +01:00
Pierre-Louis Bossart 2d70f100c7 topology: use cAVS nocodec support for APL/GLK
Move the existing sof-apl-nocodec to the development folder, in case
SOF CI still wants to use it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-06-25 11:18:28 -05:00
Pierre-Louis Bossart b5b0b2c4f2 topology: use same file for all cavs 1.8+ nocodec topologies
The beginning of the end of insanity?

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-06-25 11:18:28 -05:00