Makes even CONFIG_DEBUG builds (locally) deterministic by
default: (re)building twice produces the same binaries. Also a partial
fix for incremental builds: running "make" twice in a row now recompiles
fewer files because version.h does not keep changing.
Also makes sure non-debug builds can't use uninitialized strings in some
future security accident.
Fixes:
./scripts/checkpatch.pl -g 'aa85e2c0e956c'
ERROR: Use of the '__DATE__' macro makes the build non-deterministic
+ .date = __DATE__,
ERROR: Use of the '__TIME__' macro makes the build non-deterministic
+ .time = __TIME__,
The previous behavior can be restored using any standard CMake
configuration method, example:
./scripts/xtensa-build-all.sh apl
cmake -B build_apl_gcc/ -DBUILD_COUNTERS=1
make -C build_apl_gcc
https://reproducible-builds.org/
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Pipelines can be shared between multiple PCM's. For example,
in the case of the sof-apl-nocodec, a part of pipeline 1
(mixer1.0 ->BUF1.2 ->PGA1.1-> BUF1.3 -> SSP0.OUT)
is shared between PCM0 and PCM7. Setting the source_comp for
pipeline 1 to NULL when PCM0 is stopped results in a panic.
So, hold off resetting the pipeline until the scheduler widget
is freed.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
you need to use a temp var always with realloc, otherwise you through
away your pointer to your memory (which is still valid) in the event of
realloc failing.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
following commit fixes a bug but to do the fix we need to allow
ourselves more room to add ifs, so lets pull out this function
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
The pipeline was limited to 48 kHz min and max that is not
useful for running and testing SRC component.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The Zephyr scheduling domain is triggered by a periodic timer, which
is started when the first task in the domain is scheduled and
stopped when the domain is unregistered. Since the timer period is
anyway fixed, it's even easier to just start the timer when the
domain is registered. This eliminates the need for the .domain_set()
method completely.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>