Commit Graph

37 Commits

Author SHA1 Message Date
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
Liam Girdwood 67ae353bfb tplg_parser: support building as static or shared library.
Allow the tplg_parser to built as either static or shared library.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Liam Girdwood d9f9340e1a tplg_parser: split out testbench logic and partition features per file.
This is another tplg_parser and testbench update on the road to provide
further flexibility around supporting new modules and IPC versions.
There will more to follow.

Changes are mostly mechanical code movements i.e. moving testbench related code
to the testbench, splitting the files into per module/component files and
making some functions static and public.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-08-29 14:11:29 +01:00
Ranjani Sridharan b80fc03c4c tplg_parser: Add support for parsing process components by UUID
Add support for loading the process components by UUID. This needs a
modification in the IPC3 helper to modify the ipc data pointer to
address followed by the UUID in the component extended data.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-07-18 16:56:40 +01:00
Ranjani Sridharan c40743ec8d testbench: add support for parsing UUID
In preparation for comverting the volume component to use the module
interface, add support for parsing the UUID from topology when parsing
the PGA widget in testbench.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-06-10 09:50:08 +01:00
Liam Girdwood 0db4a82964 tplg parser: refactor and cleanup part 1
No functional change.

Move some common testbench code into the topology parser and group
feature parsing by file name.

Add a tplg_ prefix to external APIs without a prefix, others with an
existing prefix to follow this change.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-03-24 16:54:40 +00:00
Liam Girdwood 0cec50a976 testbench: further refactor of per pipeline data
The testbench currently has a global structure that contains
per topology and per pipeline data. Refactor to move data to the
most appropriate structure for use.

This is not the final fix, further refactoring is needed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-02-08 10:43:18 +00:00
Liam Girdwood 28761ec8ab testbench: add support for virtual cores as threads
This is the first step in running a full DSP topology on multiple testbench
"virtual" cores. Testbench will use threads to virtualise a emulate a core
allowing topologies with more than one core to run simultaneously.

This patch makes the following changes.

1) Adds and passes a topology testbench context to all APIs instead of
   relying on some globals.

2) Splits the testbench up into small functions that have a single purpose.

3) Creates a thread for each pipeline which in turn share a virtual core.

4) Adds the command line options to enable testing different cores and
   pipelines.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2022-01-31 16:16:27 +00:00
Curtis Malainey a0acad3414 CMake: require version 3.13
Without CMP0079 we cannot conditionally include libraries against SOF in
sub directories without seriously restructuring the project. This is
because the old policy requires the link target must be created in the
same folder. This does not work well from a configuration standpoint for
3P audio libraries trying to keep their config in src/audio/*. Rather
than enable the policy, lets simply upgrade since 3.13 is widely
available.

With this upgrade we can also remove the two version dependent checks at
the top of our scripts.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-09-10 17:19:29 +01:00
Curtis Malainey f227ae7af2 tplg_parser: fix exit path
goto after return is incorrect since it generates unreachable code.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 30f7931c4e tplg_parser: don't use void * in pointer math
Void * math is technically undefined, so for portability sake lets not
use it.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey 5436fec004 tplg_parser: don't use unsigned types with signed math
cppcheck is (legitmately) upset that we are doing signed math size_t

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Curtis Malainey f2bd45bac8 tplg_parser: don't assign unused values
minor style violation

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-22 11:30:38 +01:00
Liam Girdwood 0f2c9d1230 cleanup: remove double blanks lines.
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>
2021-04-12 16:58:51 +01:00
Curtis Malainey fd398c9d5e cmake: allow testbench to build with clang
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>
2020-09-28 10:37:26 +01:00
Jaska Uimonen a44946b8ba tools: tplg_parser: add uuid token parsing
Add parsing methods for UUID tokens.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-09-07 12:04:28 +01:00
Pin-chih Lin 92761cf7bc tools: tplg_parser: Add Crossover component
Add Crossover component for tplg_parser.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-09-02 14:31:25 +01:00
Mohana Datta Yelugoti 2e07bb9d89 tools: testbench: send valid pointer to free system call
free() system call frees the memory space pointed to by
ptr, which must have been returned by previous call to
malloc(), calloc() or realloc().

Now, when incrementing the array pointer, we may have
exceeded the actual allocated size. If we do pointer arithmetic
and subtract size from the array pointer, we may not point to
the actual location returned by malloc().

This patch makes sure that when we do pointer arithmetic on array,
the array's value at the end would be same as the one returned
by malloc.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-21 10:50:23 +01:00
Mohana Datta Yelugoti 96a474897a tools: testbench: check for array size mismatch for components
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>
2020-08-18 10:36:41 +01:00
Mohana Datta Yelugoti 782d4ce3fd testbench: check array size mismatch while loading topology buffer
This patch uses the functionality added by the c9e090c commit
to check for array size mismatch while loading topology
buffer.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-18 10:36:41 +01:00
Mohana Datta Yelugoti d9712ef671 testbench: topology:check array size mismatch in filewrite component
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>
2020-08-18 10:36:41 +01:00
Mohana Datta Yelugoti 4758413fda testbench: check array size in component parsing
There may be a situation where size of all elements of the
snd_tplg_vendor_array is greater than the private data size.

If we take a look at array structure
struct snd_soc_tplg_vendor_array {
	__le32 size;	/* size in bytes of the array, including all elements */
	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
	__le32 num_elems;	/* number of elements in array */
	union {
		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
		struct snd_soc_tplg_vendor_value_elem value[0];
		struct snd_soc_tplg_vendor_string_elem string[0];
	};
} __attribute__((packed));

and assume of private data size is size.

If num_elems * sizeof(..._elem) > size occurs, this is bad
because, we first try to allocate _size_ bytes via malloc to array
pointer. Since the num_elems * sizeof(..._elem) is greater than
size, we get a segmentation fault when we try to memcpy the
remaining size in the subsequent functions (read tplg_read_array()).

We fix this problem by checking for whether array size falls
within the bounds of private data size.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-14 15:13:12 +01:00
Pin-chih Lin d38d5892f6 tools: testbench: Support multiple output files
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>
2020-08-06 12:25:14 +01:00
Mohana Datta Yelugoti bc1d785b4d tools: tplg_parser: check if parameter is valid before using it
Before accessing the contents of the parameter pointer of the
function, check if the pointer is NULL. Else, it may lead to
segmentation fault.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 21:41:05 +01:00
Seppo Ingalsuo fa4a7bda4e Testbench: Check num_elems in tokens parsing
This patch adds check for sane num_elems value. If the calculated
array size exceeds the value size an error is returned and topology
parsing is aborted.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-08-04 11:25:35 +01:00
Mohana Datta Yelugoti 8737e0b726 tools: tplg_parser: free allocated memory to avoid memory leaks
When an error is occurred when loading the widget, the memory
allocated is not freed properly. This results in memory leaks.
Avoid these memory leaks by freeing the allocated memory before
exiting the function by returning error value.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-04 11:10:24 +01:00
Seppo Ingalsuo 374a1d6af4 Testbench: Check tplg_read_array() error codes in topology parsing
This patch adds the missing error codes check to avoid the parsing
to continue after a possible file I/O fail.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-05-07 17:33:07 +01:00
Seppo Ingalsuo 578d698e5e Testbench: Return -errno values from malloc and fseek functions
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>
2020-05-07 17:33:07 +01:00
Seppo Ingalsuo c614ed38bb Testbench: Parse all buffer widget vendor arrays
In some topologies there is a component tokens array after buffer
tokens array for buffer widget. Since the earlier code version was
able to handle only single array and did not skip the remaining it
caused the remaining topology parsing to go out of sync and fail.

This patch changes the vendor array parsing to be similar as for PCM
widget that already had capability to handle several arrays. The core
id is retrieved if present in topology and passed via IPC.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-05-07 17:33:07 +01:00
Marc Herbert 9b1b6158e3 tplg_parser: fix -Werror=maybe-uninitialized source, sink
Fixes:

tplg_parser.c: In function ‘tplg_load_graph’:
tplg_parser.c:979:2: error: ‘sink’ may be used uninitialized
                     in this function [-Werror=maybe-uninitialized]
  979 |  printf("loading route %s -> %s\n", source, sink);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-03-26 21:00:19 +00:00
Sebastiano Carlucci 60fc730003 tools: testbench: Include dcblock in testbench
This commit adds support for running test for dc blocker.

Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
2020-03-26 16:49:37 +00:00
Seppo Ingalsuo 0c35f1efde Testbench: Build topology parser with debug symbols
This patch adds compilation with -g. Optimization -O was added to get
optimization that preserves sane debugging with gdb. This component
is not critical for speed in simulation.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-03-20 13:29:00 +00:00
Seppo Ingalsuo 0eeda80bdf Testbench: Add processing component load
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>
2020-03-20 13:29:00 +00:00
Seppo Ingalsuo 0bce9e4f36 Testbench: Instantiate file component as host or DAI and other updates
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>
2020-02-26 22:29:10 +00:00
Seppo Ingalsuo 71d9dbe62b Testbench: Force core to zero to be able run the pipeline
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>
2020-01-31 21:06:39 +00:00
Seppo Ingalsuo c9bf3dc15a ASRC: Add ASRC into testbench
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>
2019-11-27 09:49:48 +00:00
Ranjani Sridharan c8b39dc9d6 testbench: Support reuse of topology parser
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>
2019-08-07 08:47:58 +02:00