Commit Graph

61 Commits

Author SHA1 Message Date
Jaroslaw Stelter 253e09feb8 idc: ipv4: Add idc_comp_free operation
New IDC request idc_comp_free() is required to delete
component located on different core than the pipline to which
the module belongs.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-11-08 14:34:35 +02:00
Peter Ujfalusi 4a27f3bce0 idc: Add phase definition to IDC_MSG_PPL_STATE extension
Add definitions for pipeline state change phases to be executed when a
PPL_STATE message is handled by a remote core.
The phase can be a combination of:
PREPARE and TRIGGER.
PREPARE will run a configuration (state change preparations) phase on the
	pipeline
TRIGGER will run a a trigger on the pipeline

Set ONESHOT in ipc4_set_pipeline_state() to have both phases to be run in
order to avoid regression.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-08-29 18:29:05 +03:00
Peter Ujfalusi fd60858a4c idc: Add pipeline ID mask definition to IDC_MSG_PPL_STATE extension
In preparation to share the extension with an action, first introduce a
mask so that the idc code is prepared for a shared use of the extension.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-08-29 18:29:05 +03:00
Jakub Dabek 45d56931ef memory management: Add virtual heap memory allocators
Add virtual heap allocators that allocate on proper heaps and
map physical memory where nesscessary.
Add free function that frees up the virtual heap memory and
unmaps physical memory when possible.
Virtual heap allocator allows using virtual memory as a base
for allocation and booking memory. Physical memory banks
will be mapped when needed allowing for greater flexibility
with mapping.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2023-08-01 08:55:50 +02:00
Adrian Bonislawski 4832dc9388 ipc4: multi pipeline set state on different cores
This will allow to correctly set multiple pipelines state
even if they are allocated on different cores.

ipc4_set_pipeline_state will check if several cores are involved
- set ppl state if only current core requested
- process IPC on another core if only single secondary core requested
- send IDC messages if several secondary cores involved

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2023-07-31 15:55:36 +02:00
Serhiy Katsyuba 071ba084a6 Add remote get_attribute for cross core connection
To support pipelines connection between cores, ipc4_create_buffer()
must be able to create buffer shared between source and sink
components created on different cores. ipc4_create_buffer() requires
source component obs size. When both source and sink components
created on same core, ipc4_create_buffer() is executed on that core,
otherwise it is executed of core 0 (IPC processing core). So for the
case when source and sink components are created on different cores
comp_get_attribute_remote() is used to receive source obs size.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-07-26 14:39:14 +01:00
Serhiy Katsyuba a63a877dbe bind/unbind support for cross core connection
bind/unbind handler must be called from core on which component was
created.
When both source and sink components are created on same core,
bind/unbind IPC is processed on that core. However, when connected
source and sink are on different cores, IPC is processed on core 0.
Hence comp_bind_remote() and comp_unbide_remote() is added to call
bind/unbide from proper core.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-07-26 14:39:14 +01:00
Rander Wang f449a22cc7 ipc4: zephyr: remove useless member in struct sof for native driver
Struct cascade_root & mn are used by xtos build only so remove them for
zephyr native driver. And these two items are too specific to intel
platforms. Remove these item also save memory.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-07-11 13:55:01 +01:00
Marcin Szkudlinski 4e8040c232 platform: ace: Add pm notifiers to support Zephyr's D3 transition
During PowerOff (D3) transition Zephyr Power Manager must have
a pointer in IMR to save the LP/HPSRAM memory before
powering off.

As zephyr has no access to IMR heap, the memory must
be allocated by SOF

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-06-28 15:32:16 +03:00
Laurentiu Mihalcea ff0fc14c11 zephyr: include: rtos: cache.h: Remove unused macros
This commit removes CACHE_INVALIDATE and CACHE_WRITEBACK_INV
macros which are not used.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-25 14:26:17 +03:00
Laurentiu Mihalcea 58b96d1c7f zephyr: include: rtos: Switch to using Zephyr cache management API
Thanks to PR [1], Zephyr cache management API can now be
used on xtensa-based SoCs. As a consequence to this, there's
no longer a need to use SOF's arch/ layer for cache management.
This commit forces all SoCs which support Zephyr to use
its native cache management API.

[1]: https://github.com/zephyrproject-rtos/zephyr/pull/50136

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-05-25 14:26:17 +03:00
Tomasz Leman 93947f98a4 platform: ace: notifying about idle thread readiness
Informing the primary core that the Idle thread on secondary core is
ready. During the D3 exit flow thread is not initialize again, but
restored from previously saved context.

This patch includes also zephyr version update to aba3b12e31 (total 15
commits). Changes related to intel_adsp contain refactor and fixes for
ACE secondary cores power flows.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-05-11 19:08:28 +03:00
Gerard Marull-Paretas ca68ba68f2 zephyr: update SYS_INIT calls
Update Zephyr head, and use the new call signature:
int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-04-24 19:13:47 +03:00
Laurentiu Mihalcea f6d84391dc zephyr: include: rtos: interrupt.h: Make interrupt_get_irq work for ARM64 platforms
ARM64's GIC doesn't utilize cascaded interrupts so interrupt_get_irq
will have to return the given INTID.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-04-24 11:47:07 +03:00
Laurentiu Mihalcea db3c469ee7 zephyr: include: sof: Add Zephyr version of compiler_info.h
This is required by ARM64 platforms as they don't have
an arch/compiler_info.h so the compilation would fail.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-04-24 10:23:58 +03:00
Guennadi Liakhovetski 5cbbde7986 clock: replace per-clock locks with a global one
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>
2023-03-07 13:37:56 +02:00
Laurentiu Mihalcea 039ccee564 zephyr: Introduce Zephyr version of sof/lib/io.h
The purpose of this commit is to get rid of the dependency
on xtos/include/sof/lib/io.h when building SOF for Zephyr.
Apart from that, this commit solves or gets us closer to
solving the following issues:
	1) Compiling SOF for arm64 architecture results
	in warnings such as the following:

	"warning: cast to pointer from integer
	of different size [-Wint-to-pointer-cast]"

	2) Enabling CONFIG_SOF_ZEPHYR_STRICT_HEADERS will
	result in a compilation error. One of the causes
	for this is the fact that sof/lib/io.h doesn't
	exist.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-03-01 16:03:40 +00:00
Krzysztof Frydryk 10e1172ea5 ams: Add initial AMS implementation
Add Asynchronous Messaging Service. This can be used to communicate between
modules.
Asynchronous Messages are one-way messages from one producer to one or
multiple registered consumers. Messages between modules on different
cores are sent through IDC. All inter-core communication must be proxied
by the main core.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2023-02-28 09:10:29 +01:00
Laurentiu Mihalcea cb72ee08a5 sof: lib: Remove unused #include from cpu.h
All arch/ files should be only used by XTOS. Since the
include statement from cpu.h is not used at all we can safely
remove it. With this, we can make the split between Zephyr
and XTOS more clean.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Laurentiu Mihalcea 7ed1159e48 Switch to using rtos/idc.h instead of sof/drivers/idc.h
The purpose of this commit is to separate the XTOS-specifc
code from the Zephyr-specifc code found in sof/drivers/idc.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Laurentiu Mihalcea 0a5c049ac0 Switch to using rtos/task.h instead of sof/schedule/task.h
The purpose of this commit is to separate XTOS-specific code
from the Zephyr-specific code found in sof/schedule/task.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Laurentiu Mihalcea 2115a7bfea Switch to using rtos/sof.h instead of sof/sof.h
The purpose of this commit is to separate the XTOS-specifc
code from the Zephyr-specifc code found in sof/sof.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-22 13:15:06 +00:00
Laurentiu Mihalcea b91e253f65 include: sof: debug: Split panic.h into Zephyr and XTOS-specific headers
The purpose of this commit is to separate Zephyr-specific definitions
from XTOS-specific definitions. Based on the build, <rtos/panic.h>
will contain the required definitions.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-21 15:34:47 +00:00
Guennadi Liakhovetski d80635054f platform: remove support for Broadwell and Haswell
Remove all support for Broadwell and Haswell platforms, they
aren't supported any more.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-16 16:19:36 +00:00
Guennadi Liakhovetski 89f7aa0abd platform: remove support for Baytrail and Cherrytrail
Remove all support for Baytrail and Cherrytrail platforms, they
aren't supported on the "main" branch any more. To build SOF for them
use the "table-v2.2" branch.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-02-08 13:36:04 +00:00
Guennadi Liakhovetski 6d48dc5ca4 zephyr: add a macro for module initialisation
This macro integrates SOF modules into Zephyr initialisation
framework. SOF module initialisation functions use
DECLARE_MODULE_ADAPTER() or DECLARE_MODULE() to register with the SOF
native initialisation scheme, now the same initialisation functions
can be used with the new SOF_MODULE_INIT() macro to integrate them
into the Zephyr initialisation flow.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-26 16:54:57 +02:00
Jakub Dabek 99093bac4e memory: Add virtual memory regions gathering and structs
Add virtual memory regions info gathering from zephyr and introduce
structs agregating this information.
Add proper defines for memory management.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2023-01-17 16:10:44 +02:00
Guennadi Liakhovetski 12a553814b memcpy_s: fix the name of the last parameter
The last parameter of memcpy_s() isn't the size of the source buffer,
it's the actual number of bytes that should be copied.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-01-09 14:35:39 +00:00
Andy Ross c50eddce1f platform: Add Zephyr native_posix-based emulation environment
This extends the ideas in CONFIG_LIBRARY=y to implement SOF as an
application for the Zephyr native_posix architecture.  These are host
x86 or x86_64 binaries that include a full OS build, which can be used
(via mocked drivers) for testing against host validation environments
like ASAN/MSAN.

The mechanism uses the existing "host" architecture used by
CONFIG_LIBRARY, but adds a new platform layer named "posix", populated
entirely with stubs.

No driver integration is provided in this patch.  The resulting
executable builds correctly, but has no devices and won't do anything.

Signed-off-by: Andy Ross <andyross@google.com>
2022-12-07 17:25:39 +00:00
Andy Ross b4025e5d49 zephyr: Add missing kernel.h include
The timer.h header references k_cycle_get_64(), which is defined in
kernel.h.  Was previously hidden by a transitive include somewhere.

Signed-off-by: Andy Ross <andyross@google.com>
2022-12-07 17:25:39 +00:00
Daniel Baluta 25493e5d44 zephyr: Add zephyr lib.c standalone file
We need this in order to export symbols to external libraries.

E.g Cadence library needs __vec_memset / __vec_memcpy.

Previous commit d9aed376d5 ("zephyr: rtos: Add __vec_memcpy /
__vec_memset") is not enough in the case of external libs.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-11-11 15:57:50 +02:00
Daniel Baluta d9aed376d5 zephyr: rtos: Add __vec_memcpy / __vec_memset
libc used by Zephyr does not provide implementation for
__vec_memcpy / __vec_memset so add them here.

Fixes c90055f2f5 ("header: rtos: use rtos specific version of string.h")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-11-10 18:28:27 +02:00
Tomasz Leman e973f5245e zephyr: cpu: moving outside of the wrapper
Moving core management code out of the wrapper for solutions builded
with zephyr.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-10-26 13:27:25 +01:00
Daniel Baluta de739dd89c zephyr: Fix cycle counting on i.MX
On i.MX8 k_cycle_get_64 always returns 0 so use sof_cycle_get_64
instead.

There is no better solution to support 64bit cycle counting for i.MX
and will have to stick with this implementation.

Fixes: c3c94fc515 ("header: rtos: use rtos specific version of wait.h")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-10-18 08:57:39 +03:00
Adrian Warecki d5967d1913 platform: mtl: Add meteorlake plaftom
Added base files of meteorlake plaftom:
  Board configuration
  CPU, clock and memory configuration
  Platform bootstrap code
  IPC driver wrapper for Zephyr IPC API for ACE1.5 platforms.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Signed-off-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2022-09-21 15:15:26 +02:00
Anas Nashif ddc104c66d zephyr: both BDW and BYT are not supported in zephyr
Both Broadwell and Baytrail are not supported in zephyr and those
Kconfigs are not defined anywhere, neither in SOF nor in zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-09-16 15:32:25 +01:00
Liam Girdwood 27a3d7c2af header: rtos: use rtos specific version of cache.h
Code can now include <rtos/cache.h> which can wrap onto rtos cache
APIs. Will wrap onto Zephyr generic cache API when ready.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood e8733b4f4c header: rtos: use rtos specific version of clk.h
Code can now include <rtos/clk.h>. API is not yet wrapped to Zephyr.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood 4843516ab8 header: rtos: use rtos specific version of alloc.h
Code can now include <rtos/alloc.h> and uses thinly wrapped Zephyr
native for most uses. Wrapping can be removed over time.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood e7d1b7bbf9 header: rtos: use rtos specific version of interrupt.h
Code can now include <rtos/interrupt.h> and uses native Zephyr IRQ API
for most uses. Some wrapping still exists which can be removed over
time. IMX is missing IRQ driver in Zephyr so falls back to xtos IRQ
driver.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Liam Girdwood e42f4a6e63 header: rtos: use rtos specific version of timer.h
Code can now include <rtos/timer.h> and uses native Zephyr timer API
for most uses. Some wrapping still exists which can be removed over
time.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-12 11:44:27 +01:00
Jaroslaw Stelter a363e882ea zephyr: rtos: Allow memory operations to be called from cpp code
The memcpy_s() function is called from CPP code in IADK modules.
Declare it as extern "C" when header included in CPP code.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-09-07 18:05:11 +01:00
Liam Girdwood c3c94fc515 header: rtos: use rtos specific version of wait.h
Code can now include <rtos/wait.h> and uses native Zephyr 64
cycle API instead of SOF version.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-09-06 15:37:21 +01:00
Liam Girdwood c90055f2f5 header: rtos: use rtos specific version of string.h
No runtime semantic change. Use C library when RTOS uses
C library otherwise use own C library calls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood 09c52810a7 header: rtos: use rtos specific version of bit.h
No runtime functional change. Code can now include <rtos/bit.h>

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood ce0879a432 header: rtos: use rtos specific version of atomic.h
No runtime functional change. Code can now include <rtos/atomic.h>

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Liam Girdwood 1629a1f72c header: rtos: decouple headers into rtos specific directories.
No functional runtime change, but changes to rtos partitioning and the
layout of headers .

This patch creates RTOS specifc header paths and updates spinlock.h
and kernel.h to show the new usage. Other headers will incrementally follow.
It reuses the current zephyr topleve directory and creates a new
toplevel xtos directory for xtos specific files.

Due to the mixing of RTOS, driver and library headers at the top level include
directory it was necessary to create rtos specific header directories i.e.

src/include/rtos-xtos
src/include/rtos-zephyr

These RTOS include directories will eventually contain RTOS specific headers
whilst common logic and structures will be placed in non RTOS directories.

This will also mean

"#include <sof/spinlock.h>"

will become

"#include <rtos/spinlock.h>"

and will allow easier visualisation of where and why RTOS headers are being used.
This will help to eliminate cross usage of headers between RTOSes.

Subsequqnt patches will move more headers and rtos specific wrppaer
source files into rtos specific locations.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-31 12:01:07 +01:00
Guennadi Liakhovetski e135633636 zephyr: update for recent Zephyr include path changes
Zephyr removed support for header inclusion without the zephyr/ path.
Update SOF with correct paths.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-08-03 20:59:53 +01:00
Daniel Baluta 1c018d517f timer: Introduce sof_cycle_get_64
With Zephyr, SOF uses k_cycle_get_64() API in order to
count clock cycles.

Not all platforms have a 64bit counter (e.g i.MX dsp integration
only has xtensa timer which is limited to 32 bits).

So, instead of using k_cycle_get_64 introduce new API sof_cycle_get_64
which keeps the existing behavior for platforms which define
CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER, otherwise use k_uptime_ticks().

See comments from @andyross at
https://github.com/zephyrproject-rtos/zephyr/pull/48318

Suggested-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-08-01 11:09:39 +01:00
Anas Nashif 33112b74e8 zephyr: use zephyr prefix for includes
Zephyr includes are now under a zephyr namespace, so use this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-18 14:22:01 +01:00