Commit Graph

6539 Commits

Author SHA1 Message Date
Liam Girdwood 74e0872f08 testebench: no need for parenthesis around case values.
Remove and use correct style.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00
Liam Girdwood 6c290043f7 ipc: abstraction: Add initial IPC4 support.
This patch adds the initial IPC4 messaging structures as used by existing
host middle ware. These are mapped onto existing pipeline APIs to support
creation of certain pipeline elements using IPC4.

This patch only upstream the interfaces, the IPC handler is to follow.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:03 +01:00
Liam Girdwood aae293a9cc ipc: remove unused typedef
Not used so remove.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:03 +01:00
Keyon Jie c979ecbc8d memory: apollolake: enlarge the heap runtime size
Increase the count of the 64 Bytes block to 160 to address the heap
runtime memory used up issue.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-02 11:27:56 +01:00
Guennadi Liakhovetski 19117f620e zephyr: ll-scheduler: convert Zephyr scheduling domain to timer API
Instead of re-calculating the next scheduling event every time use
the Zephyr timer API for the LL-scheduler Zephyr scheduling domain
in a simple periodic mode.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-01 14:58:54 +01:00
Ranjani Sridharan 9742cf3ae6 topology: clean up graph list name for all pipelines
No functional change. Graph names are not used anywhere.
But matching the name with the pipeline name will help
make it easy to convert 1.0 topologies to the 2.0 syntax.
Also remove the -PIPELINE_ID suffix from all the name as the
P_GRAPH macro adds it already.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-01 11:05:23 +01:00
Keyon Jie 9809350a62 hda-dma: allocate RUNTIME_SHARED for hda_chan
The DMA channels need to be shared among pipelines and DSP cores,
allocate buffer for it in RUNTIME_SHARED area.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-01 10:30:01 +01:00
Keyon Jie 472c3a4a39 alloc: add handle to free a buffer with uncached pointer
For multi-core support, the caller might ask for freeing buffer with
pointer to uncached buffer while the allocation happened at cached one,
add a try to match and handle the freeing of this kind of buffer.

This will help to address error like this:

src/lib/alloc.c:462  ERROR free_block(): invalid heap = 0x9e062080, cpu = 1

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-01 10:17:27 +01:00
Keyon Jie d02f12faf6 memory: add cache/uncache macros for all platforms
For Intel byt/hsw, NXP imx8/imx8m, add missing cache/uncache related
macros.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-01 10:17:27 +01:00
Liam Girdwood d62e9267f6 ipc: split IPC major code into IPC specific directories
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>
2021-05-31 13:08:20 +01:00
Slawomir Blauciak 56b0f61eaf update klocwork submodule
Commit: 5aeb95b19b

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2021-05-31 11:42:19 +01:00
Libin Yang 5d9d2ddad8 topology: fix hdmi pcm id for cnl-rt5682-sdw2
HDMI PCM id should be 5, 6, 7 as described in the
sof-cnl-rt5682-sdw2.m4.

Let's use 5, 6, 7 as the HDMI PCM ID to match the UCM setting.

Signed-off-by: Libin Yang <libin.yang@intel.com>
2021-05-27 10:54:02 +01:00
Marc Herbert 2cbeabe722 Restore original, 2018 mtrace_event(atomic) spin lock logic
Fixes bad commit b284ac32b5 ("debugability: Macro Metaprogramming
Refactor") that accidentally swapped mtrace_event() and
mtrace_event_atomic()

Before that accidental inversion, _trace_event_mboxN() functions invoked
spin_lock_irq() whereas _trace_even_mbox_atomicN() did NOT take
locks. That was consistent with the non-mbox, DMA variants of these
functions. As explained in the message of commit 3dca7b7778 ("trace:
dma: Add atomic and nowait DMA tracing support."), functions with the
`_atomic()` suffix,, are meant to be used in atomic contexts where the
lock is _already_ taken.

Searching for spin_lock_irq() in the code after the bad commit shows
that the logic was inverted for the _mbox variants: the lock became used
for the _atomic() variants.

The reasons why I can't reproduce any actual issue are likely the same
reasons why this inversion was never noticed:

- no multicore
- very little use of trace_.*_atomic variants
- spin_lock_irq() is re-entrant?

I merely noticed the inconsistency with DMA tracing while trying to
solve unrelated issues in the same places.

The non-mbox, DMA variants were not affected by the bad commit because
for DMA the lock was and is managed in a different file: dma-trace.c.

Searching "spin_lock_irq" in later commit b12a6626c5 ("trace:
Remove metaprogramming from trace implementation") shows that it
preserved this inversion across this second refactor; it left the bug
untouched.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-27 09:07:46 +01:00
Marc Herbert d641558ef0 logger: print the value of a negative DELTA when there is one
Because why not.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-27 09:07:46 +01:00
Marc Herbert be7bed9ddf logger: don't "return" when failing in the main loop, break instead
Set the error code in "ret" and only exit the loop so we don't lose the
optional warnings at the end of the loop.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-27 09:07:46 +01:00
Guennadi Liakhovetski d736888aa5 zephyr_domain: fix a recent regression
A recent commit broke calculation of the zephyr scheduling domain
period. Restore the original version.

Fixes: 5104f5e02d ("timer_domain: refine the timer_domain_set() logic")
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-26 20:27:25 +01:00
Guennadi Liakhovetski 6a37c8a101 timer_domain: remove a redundant structure member
struct timer_domain::timeout is only set and used once, use the
constant directly to simplify the logic.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-26 20:27:25 +01:00
fy.tsuo 9ae018b9fa topology: max98373-rt5682: define dmic 48k core id
Define DMIC_PIPELINE_48k_CORE to assign dmic 48k pipeline core id.

For sof-tgl-max98373-rt5682 platform, it is necessary to offload

dmic 48k pipeline to core 1 of TGL because igo_nr takes high MCPS.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-26 20:24:06 +01:00
Ben Zhang 9d21f9ecf2 topology: Add a tgl-max98357a-rt5682 tplg with DMIC16k on PDM1
There are TGL devices using either PDM0 or PDM1 port for the DMIC16k
DAI for hotword detection. This patch adds the DMIC_DAI_LINK_16k_PDM
parameter and builds both versions.

Signed-off-by: Ben Zhang <benzh@chromium.org>
2021-05-26 08:08:49 -07:00
Marc Herbert a766d22e5d trace.h: replace #ifndef CONFIG_LIBRARY negation with #ifdef
Zero functional change.

Swap the "then" and "else" clauses to remove the simple negation in the
"then" and the double negation in the "else".

Also move _DECLARE_LOG_ENTRY macro out of the #ifdef because it does not
hurt and is used in a third (with #elif) clause experiment that I'm
adding locally - the negations make adding a third clause much more
difficult and are what actually prompted this initially.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-26 13:29:42 +01:00
Iuliana Prodan e68f88dc60 init: define secondary_core_init() only on MULTICORE
Define function secondary_core_init() only on MULTICORE.
This fixes:
warning: 'secondary_core_init' defined but not used
while building SOF with Zephyr for i.MX which has only one
DSP core.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-05-26 12:59:25 +01:00
Jaska Uimonen 643db1d641 wait: print register values if poll_for_register_delay fails
Print register and its values if poll_for_register_delay fails. Also
check the return value and print warning in sai.c and dw/dma.c.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-26 12:58:12 +01:00
Kai Vehmanen 9235eb8360 kconfig: move BUILD_VM_ROM Kconfig.xtos-build
The BUILD_VM_ROM option only affects SOF XTOS builds, so move
the option to a separate file.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-25 15:53:39 +01:00
Kai Vehmanen 3541b37d46 kconfig: move XTOS build specific debug options to a separate file
Some of the DEBUG options are only used in the XTOS implementation
and do not impact e.g. Zephyr builds. Make the split explicit by
moving these options to a separate file.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-25 15:53:39 +01:00
Kai Vehmanen ffe22f2831 Kconfig: move compiler options to a separate file
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-25 15:53:39 +01:00
Marcin Rajwa 479c09b3e9 codec_adapter: cadence: rework of reset & free procedures
This patch fixes the reset procedure of cadence codecs.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2021-05-25 15:20:23 +01:00
Keyon Jie c8589b925c dai: allocate RUNTIME_SHARED for shared data
The dd and dai_spec_config need to be shared among DSP cores, allocate
them in RUNTIME_SHARED area.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-25 09:57:33 +08:00
Keyon Jie 9b8bb275c1 dw-dma: allocate RUNTIME_SHARED for dw_chan
The DMA channels need to be shared among pipelines and DSP cores,
allocate buffer for it in RUNTIME_SHARED area.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-25 09:57:33 +08:00
Marc Herbert fa5cc118b5 fuzzer: add deprecation README.md
As discussed in https://github.com/thesofproject/sof/pull/4132

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-24 15:27:18 -07:00
Marc Herbert e69e1c7eeb scripts/build-tools: some usage and other clarifications
Fixes #4141. I got tired of repeatedly having to read CMakeLists.txt
files.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-24 15:27:18 -07:00
Marc Herbert cc3b302797 .github: add build-tools.sh (all) back, lost with Travis
We used to do this in Travis, see commit 7072eb4447 ("travis: run
build-tools.sh with CMAKE_BUILD_TYPE=Release") and older.

Related to issue #4141 build-tools.sh -T does not build development
topologies.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-24 15:27:18 -07:00
Marc Herbert a5b3c8e36b logger: increase time_fmt[] size to avoid a gcc warning.
gcc does not know that we already filtered unreasonable precision
values.

Increase the size of the temporary string from 32 bytes to 64
bytes. We're running on the host, memory is cheap.

Fixes commit d6f6a456c1 ("logger: fix column and header alignments")
For some reason CMake uses -Werror=format-truncation only in Release
mode.

Avoids the following warning:

```
sof/tools/logger/convert.c: In function ‘fetch_entry’:
sof/tools/logger/convert.c:514:27: error: ‘%d’ directive output may be
  truncated writing between 1 and 10 bytes into a region of size
  between 0 and 18 [-Werror=format-truncation=]

  514 |      "%%s[%%%d.%df] (%%%d.%df)%%s ",
      |                           ^~

sof/tools/logger/convert.c:514:6: note: directive argument in the
       range [0, 2147483647]
  514 |      "%%s[%%%d.%df] (%%%d.%df)%%s ",
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /usr/include/stdio.h:867,
                 from sof/tools/logger/convert.h:13,
                 from sof/tools/logger/convert.c:21:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10:

   note: ‘__builtin___snprintf_chk’ output between 21 and 59 bytes into
   a destination of size 32

   67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |      __bos (__s), __fmt, __va_arg_pack ());
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors
```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-24 15:27:18 -07:00
Jaska Uimonen 636cbefc62 topology: add missing tokens in SSP_CONFIG_DATA
Add all same tokens to SSP_CONFIG_DATA that we have in
SSP_MULTI_CONFIG_DATA.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-24 22:02:49 +01:00
Jaska Uimonen 5cffff335d topology: remove obsolete s24_4le from COMP_SAMPLE_SIZE
Remove definition of s24_4le from COMP_SAMPLE_SIZE macro as it is not
used anywhere. Instead all pipelines are using s24le definition and the
COMP_SAMPLE_SIZE macro works only because it defaults to 4 bytes.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-05-24 17:07:14 +01:00
Iuliana Prodan 4475f604aa zephyr: trace: remove useless #ifdef __ZEPHYR__ macro
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>
2021-05-24 16:01:05 +01:00
Guennadi Liakhovetski 7bdbe295ef ll-scheduler: use a correct function to initialise a list head
In scheduler_free_ll() sch->tasks is a list head, not a list item.
Use list_init() instead of list_item_del() to initialise it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 90045619d3 ll-scheduler: only modify the task if it is valid
schedule_ll_task_cancel() looks for a task on the list to cancel it.
However, if it doesn't find the task on the list it still sets its
status and deletes it from the list. Currently this doesn't cause
any problems, but it's potentially dangerous. This function can be
called for completed tasks, which are no longer on the list. So
list_item_del() will be called for the second time for it. Currently
this isn't a problem because SOF implementation of that function
also initialises the list head, but not all doubly-linked list
implementations do that. E.g. Zephyr's sys_dlist_remove() nullifies
both .next and .prev, so, a repeated call to it would cause a
NULL dereference. In general it's safer to only modify an element
when it has been verified to be valid.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 2617ccb68a ll-scheduler: no need for a safe version of list_for_item()
The list isn't modified in schedule_ll_clients_reschedule() when
scanning it for the earliest task, replace list_for_item_safe()
with the usual list_for_item().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 56cb4f08f6 schedule: (cosmetic) remove three redundant variable initialisations
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>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 4baab5ff30 ipc: simplify a confusing variable use
The hdr variable in ipc_compact_read_msg() initially points to data
on stack, and then that variable is returned from the function,
creating an impression of a bug. However, that isn't a bug because
it is only returned from the function if it is overwritten to point
to a different data block, this time not on stack. Trivially
simplify the function to eliminate the confusion.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski b602e275c9 zephyr: kpb: fix a compiler warning
When built under Zephyr the wrong format generates a compiler
warning:

modules/audio/sof/zephyr/include/sof/trace/trace.h:35:11: warning: \
format '%d' expects argument of type 'int', but argument 3 has \
type 'uint64_t'

Since native SOF tracing cannot print 64-bit data, only print the
low 32 bits of the time interval.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 1a249e8421 ll-schedule: (cosmetic) simplify a conditional
If one of the "if" branches contains a jump instruction like "goto,"
"return," "break" etc. usually making that the only "if" branch
simplifies the code. Fix one such case in schedule_ll_task().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski c15c43e9fe clock: add a function to convert microseconds to ticks
Several code paths use the existing clock_ms_to_ticks() function in
some not ideal ways, potentially leading to computation overhead or
to precision loss. The function is often called to calculate ticks
for 1 millisecond, which then is recalculated to the required time
interval. It's better to let the function calculate the number of
ticks for the required time interval directly. E.g. instead of
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * milliseconds
it's better to call
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, milliseconds)
directly. For microseconds however replacing
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * microseconds / 1000
with
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, microseconds / 1000)
can lead to a loss of precision. To avoid that a new function
clock_us_to_ticks() is added.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Slawomir Blauciak 06c3a90b6e rimage: update rimage submodule
Updates the rimage submodule to:
6f45b61921

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2021-05-24 11:16:30 +01:00
Curtis Malainey ab7961ccbc ipc: check pipeline validity
We have some commands that fail to check the component's pipeline
pointer before running the command which results in various null pointer
dereferences across the codebase. Solution is to copy existing checks
and patch the code paths.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-24 10:31:03 +01:00
Iuliana Prodan 8357dcf793 zephyr: trace: use zephyr utilities when enabled
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>
2021-05-21 15:56:58 +01:00
fy.tsuo c32a0e032f topology: igo_nr: move igo_nr to core 1.
igo_nr runs on core 1 to balance loading.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-21 11:06:47 +01:00
fy.tsuo 9266614004 audio: igo_nr: igo_nr support 48k
To roll back SSP clock setting to original one.

igo_nr now support 48k-in-48-out and the entire pipeline

DMIC_PIPELINE_48k is reverted back to 48k too.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-21 11:06:47 +01:00
Kai Vehmanen 72a51a462f cavs: memory: fix panic on tplg load for zephyr on cavs20/25
The Zephyr linker scripts for cavs20/25 do not map sections
on uncached RAM, so the memory accesses to uncached memory will
fail. This shows up as a DSP panic while loading initial topology.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-20 16:29:33 +01:00
ShriramShastry 7de1744501 Math: Trignometry: Cordic sine() and cos()
Add static inline for math sin() and cos()
functions.This PR is just moving existing code to
improve runtime performance due to less function calls

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-05-20 15:35:26 +01:00