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>
All clients that just wants to allocate and free memory
does not need to know all the heap management api
and internals.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
New is c++ keyword which causes errors while generating
the documentation for component api with sphinx and breathe.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This patch adds to testbench capability to run pipelines with EQ_IIR
and EQ_FIR components. The component is configured with the topology
embedded configuration blob when instantiated with new().
The load of volume component has been enhanced to parse volume tokens and
compute the min and max volume parameters.
The topology parsing and component library load has been changed to
support processing component load and extracting of control private
data. The testbench build has been changed to create libraries
for EQ components.
The testbench command line parsing has been improved to return
error for invalid library request.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The current content of component.h is a mix of basic api, common
basic helpers for every component developers as well as advanced
functions and macros used by infrastructure and very specialized
components like host, dai, kpb etc.
This patch moves the advanced part to component_ext.h and keeps
only basic part in component.h to avoid overloading effects
component developers with declarations and code they do not use.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
Changes implementation of notifications allocation.
Instead of using common empty list of messages let's
switch to allocating message per source of notification.
This way we won't have problem with memory and lack of
empty messages and also we will be able to optimize memory.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
There was missing argument in file_get_hw_params, what breaks compilation.
Fixes: 2b84838 ("Testbench: Instantiate file component as host")
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This patch fixes the fail to execute tests due to recent pipeline
updates. Now the fileread and filewrite component is instantiated
as host or DAI depending on stream direction. The DAI file component
is added the capability to report HW stream parameters. In testbench
case the stream parameters originate from command line parameters.
The file params() handling is updated to be similar as in other
components to successfully propagate the parameters.
The added capture pipelines support is not fully functional and will
be fixed later.
The testbench cleanup includes elimination of global variables for
certain component ids. The needed misc parameters were added to
testbench parameters struct that is passed through most topology
parsing functions.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Back pointer must be initialized before any instance
level logging is performed by the new() operation since
the instance identification requires access to the uuid
that will be implemented on the component driver level.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
Static inline getters provides better control of use
component properties as L- and R-values.
They also make changes to the common component data defs
easier and transparent for clients (no code changes, just
recompilation required).
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This patch fixes build fail of testbench. The packed attribute
is added similarly as in IPC structs of other components. The
reported error with gcc 9.2.1 is:
sof/tools/testbench/file.c:408:11: error: converting a packed
‘struct sof_ipc_comp’ pointer (alignment 1) to a
‘struct sof_ipc_comp_file’ pointer (alignment 8) may result in
an unaligned pointer value [-Werror=address-of-packed-member]
408 | (struct sof_ipc_comp_file *)comp;
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch avoids the testbench to crash when file read or write
file open was not successful. E.g. invoking testbench with
incorrect input file name caused a segfault.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds force of scheduler type to EDF since it is the
only simplified scheduler version that is included to testbench.
The schedule_task_init_ll() stub is updated to call schedule_task_init()
to prevent a check for NULL run operation to fail. The patch also
changes the memory allocation to calloc() to clear the reserved data
to value NULL for similarity with rzalloc() in SOF.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds the missing call to end of test run. It prevents
the pipeline reset to print error traces about illegal state
change.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch sets in topology parsing core to zero for file reader,
file writer, and buffer since it was left uninitialized and caused
the core check in pipeline run to fail.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch retrieves the channels count either from sink or
source. The previous code failed for file read since source
is NULL. A similar kind of mistake also caused the period_bytes
to be calculated as zero.
Finally as code simplification the calculation of bytes is moved
to variable declaration to avoid duplicated statement.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch adds the initialization to testbench start code. Without
it the notification from buffer consume/produce causes segfault.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Probes are a feature that will allow user to extract and inject data
from/into buffers at runtime.
Basic flow is as follows:
1. Initialization of probes subsystem, allowing for simultaneous
configuration of DMA for extraction. If extraction DMA is not setup
during init, extraction probes will be disabled.
2. Configuration of probe points, preceded by DMA configuration in case
of injection probes.
3. Probes are now in operation and will send single multiplexed stream from
extraction probe points and inject data into specified buffers.
4. State of probes and associated DMAs may be retrieved via INFO functions.
5. Removal of probe points.
6. Removal of injection DMAs.
7. Deinitialization of probes subsystem.
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
When new component will need to process audio data in two steps,
then temporary circular buffer will be needed. Also extra information
about data stream may be needed to choose right algorithm or assert data
compatibility.
Currently only 'comp_buffer' has such a possibility but it is component
defined in topology - with much wider capabilities - and shouldn't be
created inside component just to hold temporary data stream.
Use introduced structure in processing functions, move api responsible
for data processing from buffer to audio_stream module.
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Changes component driver registration to use comp_driver_info
as an element to be put into the drivers list. This way
comp_driver can be constant and comp_driver_info can be
marked as shared in the future.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Passes sof context pointer to sys_comp_init() function.
It will be needed in order to add comp_driver_list to
sof context.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes shared_ctx from ipc structure and add its members
directly to struct ipc. From now on ipc struct needs to
be shared to support SMP. It's done in order to eliminate
possible wrong pointer to shared_ctx, since it was a part
of cached data.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Creates new mem_zone enum type for heap zones.
We don't want to leave them as flags and allow
zone combinations.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes zone argument from balloc related functions.
They always use RZONE_BUFFER, so passing something else
is very misleading, especially it changes nothing.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Extracts flags from zone to use them as a separate argument
during allocations. It allows for addition of new zones and
also is more clear this way.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes need to pass EDF task priority during initialization.
Also removes priority definitions, which were only used by
EDF scheduler. Priorities of EDF tasks are now deprecated.
We are scheduling based only on deadline.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Extracts task operations to separate struct. This way we can
add additional ops without need to endlessly adding parameters
to schedule_edf_task_init function.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Separates task init functions for all currently supported schedulers.
Some of the parameters are not common, so there is no need to
artificially extend function signatures.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Moving pcm params from component to buffer is the first
step to improve parameter propagation within pipelines. This commit
moves several pcm paremeters (framet_fmt, buffer_fmt, rate,
channels, chmap, except direction) to comp_buffer struct.
Some of specific parameters are moved to private host and
kpb data.
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
This patch adds the ASRC component and the new tokens into topology
parser and testbench component loader.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This change adds stream map and channel map structures
used for channel re-routing and stream aggregation.
Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
Use RELATIVE_FILE because __FILE__ makes binary output
dependent on project location.
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Changes scheduler_init_edf and task_main_init function
definitions as sof structure is no longer needed. It was
only used to pass agent object to main idle task.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Fix alloc definitions for host build.
Function definitions were using defines in their body
which blocked usage of const values in said defines.
Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
Adds complete callback to task. Some EDF tasks will need to have
additional callback on task completion, which will be executed
in critical section along the setting task state to complete.
Doing it during regular execution is not enough, because it's done
on passive level and we want to avoid any race condition.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This patch updates the locations of "make install" libraries default
install locations into shell script to run SRC test cases. The script
also now prints the used LD_LIBRARY path to ease setting up code
debugging.
The segfault of testbench executable is fixed by returning a valid
pointer reference instead of a NULL from test dummy function
arch_schedulers_get(). The rest of testbench version of schedule.c
was also updated to be like the current real version module.
Finally in the testbench.c main the file names string pointers are
initilizated to null as well as the word length parameter to avoid
a segfault if executable is started without command line arguments
to see the usage help text.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Refactors schedule code in order to allow dynamic scheduler
creation. We don't want to add every new scheduler to the static
array of scheduler_ops and also we don't want to have every
scheduler created on every platform. Maybe some of the platforms
won't need some of the future scheduler types.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Passes sof context structure to the schedulers during
scheduler initialization. It will be required by the new
EDF scheduler.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Replaces spin_lock_* macros with irq_local_* macros
in many places. Most of the code doesn't need to keep
synchronization between cores. Setting critical section
by disabling local interrupts is enough. Spinlocks should
be used only in the places, where both cores have access.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
The topology parser in testbench can be re-used for
the other applications like the fuzzer. In order to
accomplish this, this commit does the following:
1. Separate the topology parser into a separate project
(tplg_parser) which implements the callbacks for parsing
all the components in topology.
2. Add support for parsing new components such as host
pcm, dai and mixer
3. Include the topology parser as an external project
in the testbench.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Refactors timer a little bit, to make better usage
of timer id values. Right now every timer has also irq
field, which is used to identify which interrupt line
to enable/disable. We don't longer need timer id to represent
also timer irq, so let's set custom ids and simplify
things.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Instead of returning next period, schedule functions should return
state of the executed task. Period of the tasks is set during
initialization and doesn't change dynamically, so it doesn't make
sense to return it. With the new added SOF_TASK_STATE_RESCHEDULE
we can easily decide if the task is completed or maybe need to
be run once again.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Extracts flags to generic task data, so there is no need
for ll_schedule to keep them privately. Also changes the
way they are passed. From now on flags should be set only
during task initialization and not when starting scheduling.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds new period field to task private data to keep
period set during schedule. Tasks shouldn't change
their period dynamically and in fact there is no
such task.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Moves headers to dedicated directories in sof/include,
arch/include and platform/include. File tree was too flat,
so some of the files has been moved.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Cleanups includes in all drivers, include and
platform files. Unused headers has been removed
and needed has beed added.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Extracts schedule related implementations to the separate
directory to make it easier to locate and implement new
schedulers in the future.
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Some of interface headers are not needed by kernel,
but are needed by user-space applications, so we can split them
into multiple directories that indicate their purpose.
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Ipc private data needed by ptable processing removed from
platforms that do not use it.
Less ifdef-s in the main common ipc code, another new unit
compiled for platforms that require ptables.
Dependency on the private data removed from the main ipc code
and moved to the platform specific code. A dependency between
ipc-host-ptable and platform's ipc private data is easier to
maintain then duplicated code in the main ipc units.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This flag is not private since used by the common IPC handler layer.
This move enables also the next step to make the ipc private data really
private (hidden in the platform ipc code) and make platform specific.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This patch fixes the freeze problem when running pipeline in
testbench. The file read/write component needs to use similar
logic to determine number of frames to process as the the
components under test those have been updated to work with timer
based scheduling.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>