Decouple the IPC ABI major version from pipeline creation. This moves
struct sof_ipc_pipe_new from the pipeline and replaces it with it's
members (saving 8 bytes as no header is needed).
Add new feature specific pipeline APIs to configure pipeline at creation.
Additionally align testbench and UTs to API change.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
IPC is aligned on at least 4 bytes, removes compiler warning about packed
data being aligned on 1 bytes.
In file included from /home/lrg/work/sof/sof/tools/testbench/file.c:23:
/home/lrg/work/sof/sof/tools/testbench/include/testbench/file.h:59:1: error: alignment 1 of ‘struct sof_ipc_comp_file’ is less than 4 [-Werror=packed-not-aligned]
59 | } __attribute__((packed));
| ^
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Give the compiler a chance to further optimise IPC data access since it's
all on a 4 byte alignment.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Split IPC APIs out by feature so that the IPC layer to help future
IPC infrastructure changes support more than one IPC ABI MAJOR version.
No code changes here, only code partitioning and Doxygen comments.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Several files had multiple blank lines even before the removal of
platform_shared_commit(). Fix them with "cat -s"
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add cmake -DINIT_CONFIG= option that can point at any initial file.
"make clean" does not delete .config any more.
Note reconfiguration does NOT causes recompilation because -imacros
hides the generated .h from CMake's dependency scan. This is not a
regression, that problems exists since -imacros was introduced. At least
it's now possible to "make clean" and rebuild without losing the .config
file.
Fix for #3617
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This fixes compilation with:
CFLAGS=-fno-common ./scripts/rebuild-testbench.sh
sof/tools/testbench/topology.c:24: multiple definition of `lib_table';
sof/tools/testbench/testbench.c:39: first defined here
This was detected by Gentoo 10 which uses -fno-common by default, thanks
Guennadi for the report and investigation.
Commit 03067c6c77 ("host: set up shared library table") introduced a
strange "lib_table" symbol that was apparently meant to be global but
was not really because of some confusion between arrays and pointers and
needed to be passed around and "initialized to itself" (!) at run time
as seen in the sample trace below:
topology.c
struct shared_lib_table *lib_table;
parse_topology(..., library_table,...)
{
printf("DEBUG1 ----- %p, %p, %p\n",
&lib_table, lib_table, library_table);
lib_table = library_table;
printf("DEBUG2 ----- %p, %p, %p\n",
&lib_table, lib_table, library_table);
}
Log:
DEBUG1 ----- 0x56298c954040, 0x56298c951183, 0x56298c954040
DEBUG2 ----- 0x56298c954040, 0x56298c954040, 0x56298c954040
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
In order to support more linux based testing apps lets move the drivers
for the library build into the rest of the source tree so it is easy to
develop additional apps.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
We need clang support for the testbench therefore the following changes
are needed
remove -ftree-vectorizer-verbose since its deprecated in gcc and not
supported in clang
remove =3 from -Wimplicit-fallthrough=3 since 3 is the default level
anyways
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
UUID objects are represented by struct sof_uuid_entry instances in SOF.
Instead of casting pointers to them to integers for passing around,
carry them as pointers until they have to be cast to integers for
packing into data structures. This also fixes printing UUID, using a
"%pU" format.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The if test needs to be done for comp_type. The index does not refer
to comp types but items in lib_table that is not correct. As result
testbench loads crossover for all UUID based components. The load of
beamformer works correctly with this change.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Add methods to load process libraries based on uuid. Testbench will
first search the old process enums and if match isn't found the same
search is done with uuid. Hence old process components should get loaded
with enums and new uuid based components should get loaded with uuids if
the uuid definition is declared and added to the library table.
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
This patch fixes a segfault with null sof->sa pointer in
pipeline_schedule_copy() function. The bug has not been observed
with test topologies for processing pipelines but with other
topologies with fuzzer varied parameters.
The sa_init() is added to tb_pipeline_setup(). The scheduler_init_edf()
is a dependency. The two dummy functions platform_timer_get() and
clock_ms_to_ticks() are also added as dependency. The CMakelist for
library is edited to include agent.c build for testbench.
Fixes#3247
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
If user fails to provide a topology file, the tplg_file member
of structure tp is left uninitialized. This member is used to
check again if the file was provided, which won't be possible
unless this has been initialized to NULL and checked for NULL
after parsing arguments.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This patch uses the functionality added by the c9e090ccf3 commit
to check for array size mismatch in various components.
Not doing so may result in cases, where we try to write into the
space not allocated leading to segmentation fault.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This patch uses the functionality added by the c9e090ccf3 commit
to check for array size mismatch in components.
Since, the components are in places other than tplg_parser, the
function which checks for the mismatch has been made an external
function from a static one. The function declaration has been
added to the tplg_parser header files, so that the function can
be used by any code which needs array size checks in components.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
When the realloc() function fails, a NULL pointer is returned. But,
if the size argument is zero, then also NULL is returned. So, to
differentiate that, we also check if size is non zero. Only if
pointer is NULL and size is non-zero, we come to the conclusion that
realloc() failed and the allocated memory till now is freed and
appropriate error is returned.
If realloc is called on a pointer and fails, the memory pointed by
the pointer isn't freed. When realloc() fails, even this memory
is freed.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
In order to run multi-output component playback by testbench, this patch
supports multiple output file mode on running testbench. Argument "-o" is
modified to accept specifying up to 4 filenames delimited by comma,
e.g. "-o output1,output2,..."
Moreover, debug messages in tplg_parser/tplg_parser.c is refined for
demonstrating multiple pipelines better.
Signed-off-by: Pin-chih Lin <johnylin@google.com>
When we try to free a pointer which is not initialized, we are
using a value in the program which is undefined. So, initialize
the pointer variable, so that in future, when we free the pointer
it won't cause a problem.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
All audio_stream clients should use provided audio_stream_get_avail*/free*
API, instead of directly accessing .avail and .free member fields.
Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
tb_pipeline_params() function takes an argument called ipc_pipe,
which is a pointer and is derefernced in the function to access
a member of structure that pointer is pointing to.
If this pointer is NULL, this leads to Segmentation fault. A
null pointer check is added before the argument is dereferenced.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This is not needed yet as we use only one -imacros at a time but could
save someone a lot of time in the future; including the author of this
patch who will have forgotten about it in a few weeks.
For more details see
https://github.com/zephyrproject-rtos/zephyr/commit/e53c0d0ec7640b
and links from there.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Using -imacros on the compiler command line instead of explicitly
including config.h is not just less tedious in the future:
- it also makes sure configuration always comes first and is never
accidentally missed by an earlier #include
- it makes sure all translation units get the (same) configuration
- it lets parent projects like Zephyr override the config.h name
To test this I ran ./scripts/xtensa-build-all.sh -a -r, compared
binaries before and after this change and found no output difference.
Full disclosure: this required a few unrelated tricks not submitted here
like a .tarball-version file, commenting out __DATE__ and __TIME__ in a
few places, running strip-determinism on the .a files because our
crosstool-ng reference is not cutting-edge, etc.
As Tigerlake is not built by default it required a couple more hacks to
compile.
Blank lines are left instead of the former #include lines so even debug
objects are the same.
Only defconfigs were tested. On the other hand, this commit was _not_
performed by a script but by changing the name of the generated file and
clicking on and fixing every build failure. This proves that every
removed #include was actually required by one or more tested defconfigs
and that the added -imacros flag does affect the compilation of all the
modified files.
There is no #include config.h left: they were all in use in at least
one _defconfig.
I think comparing all binaries produced by ./scripts/xtensa-build-all.sh
-r -a provides extensive enough coverage but note this was tested only
with the crosstool-ng toolchain described in the SOF documentation.
The obsolete[*] xt-xcc front-end is gcc-based and the newer xt-clang
front-end is (surprise) clang-based. clang (copies many gcc options and)
does support -imacros so I don't expect any issue with either xt-xcc or
xt-clang. In the worst case, I do not expect any compiler front end to
_silently_ discard any unknown command line flag nor to ignore a missing
or misnamed config.h file.
[*] https://github.com/zephyrproject-rtos/zephyr/issues/3165
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit rewrites functions responsible for large config configuration
from detect_test component and puts them in component.c file as
generic ones - as a result they can be used by other components.
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
Each component driver should have assigned UUID value and trace
contecxt, to allow generic component creation routine usage.
It's espiecially important for trace context, because it's
accessed by pointer so dereferencing NULL pointer will lead to
segmentation fault.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This patch replaces the manually set error codes with errno that
is set to exact fail reason like ENOMEM etc. by these functions. The
missing return code checks for fseek() calls are added.
Include of header errno.h is added to topology.c. The order of
include statements is fixed.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
All trace entries are identified by uuids only now.
Previous TRACE_CLASS_ identification removed completely.
UUIDs are passed to the tracing subsystem inside a trace
context. Each trace context defines run-time log level.
The level is initialized to LOG_LEVEL_INFO (this may be
change per instance is needed) and may be re-configured
at run-time.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
rrealloc function is no longer in use, so it is better
to remove it. Unused code is no longer tested so its
quality is unknown.
The current implementation is simple but expensive since
extra calls to malloc/free requires time and risky since
at some point requires double allocation of potentially
large object. Please consider re-implementation instead
of restoring.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
Changes schedule operations to return error in case
chosen scheduler is not found or scheduler doesn't
support mandatory operation.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Previous memcpy of bytes is unsafe if new object is larger
then old one.
Typically realloc retrieves the old size internally and does
not need this information passed as argument but sof heap
implementation does not store the exact size of the allocated
memory buffer.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
Previous memcpy of bytes is unsafe if new object is larger
then old one (which is probably most popular realloc use).
Typically realloc retrieves the old size internally and does
not need this information passed as argument but sof heap
implementation does not store the exact size of the allocated
memory buffer.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
Once the debug version of allocation functions are removed,
macros may be replaced with functions declared without leading
_ which makes the documentation (and the header) more readable,
the defines section does not need to contain doubled documentation
of alloc api.
bzero macro is not esasily removable due to include deps which
bring earlier declaration of non-inline prototype.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This patch fixes the crash by adding initialize of sof->pipeline_posn
into pipeline initialization code.
Also the in load_pipeline() function the pipeline is initialized
to zeros to prevent random values to be passed in not set
struct fields. It didn't fix anything but makes debugging of crash
easier.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>