Commit Graph

3556 Commits

Author SHA1 Message Date
Ranjani Sridharan 2f9b43bac0 tools: fuzzer: Introducing ingredients for fuzzing in SOF
This commit introduces the ingredients required for adding
fuzzing support in SOF. The main ingredients are as follows:

QEMU bridge: This creates the IO bridge to communicate with
the QEMU DSP

Core IA host support for BYT/CHT platforms: Provides the host
support for intializing the platform and communicating with
the QEMU DSP

Main application: The fuzzing application that sets up the
platform and initializes the communication with the QEMU DSP

Currently, running the fuzzer application only sets up the
platform IO bridge for communicating with the QEMU DSP,
boots the FW, parses the topology file and sets up the components
and connections in topology by sending the IPC messages to
the QEMU DSP. The next step is to add the fuzzing component
which will be responsible for sending fuzzed IPC messages
and monitoring the status.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2019-08-07 08:47:58 +02: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
Tomasz Lauda 9e2aa3d3ac alloc: fully synchronize memory map between cores
Adds cache operations to alloc functions to get full
synchronized memory map between different cores.
Memory allocations aren't done so often so we can
afford to go through cache and perform so many
wtb/inv operations. This change allows slave cores
for allocation from runtime heap, buffer heaps etc.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 20:52:53 +02:00
Tomasz Lauda 976b9d647a timer: cavs: add missing labels for TIMER4
Adds missing switch labels for TIMER4.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:59:27 +01:00
Tomasz Lauda 4de76bf578 timer: change id values
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>
2019-08-06 18:59:27 +01:00
Tomasz Lauda ec9d1cad94 schedule: make some functions static inline
Transforms some of the short functions to static inline.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda b3233c435e schedule: remove functions forward declarations
Removes not needed forward declarations of the functions.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 4100fa0ac3 schedule: make schedule functions return task state
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>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 8920419137 task: reorder task structure
Reorders task structure in order to gain better padding
and don't waste any space.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda f4c6d35761 task: make enum from task states
Makes enum from task states for better type
enforcement in the future.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 99005e21bc schedule: extract flags to generic task data
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>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 2d16db19de ll_schedule: keep task period in private data
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>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 8309e53e6c ll_schedule: decrease code of schedule and reschedule
Decreases code of schedule and reschedule functions by
removing small helper methods, which weren't needed.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 8025432217 schedule: writeback and invalidate tasks
Adds cache operations in task init and schedule functions.
It allows to put tasks' private data in cached memory, which
will be needed in the near future with new EDF implementation.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda 79dfc19a4b cpu: add cpu_is_slave method
Implements cpu_is_slave helper method, which checks
whether the provided core is slave.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:51:20 +01:00
Tomasz Lauda b201fc77f0 cpu: use cpu_get_id instead of arch version
Changes usage from arch_cpu_get_id to cpu_get_id.
We always should go through generic function version.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda 4563f2c12d pipeline: add function for checking pipe execution core
Extracts check whether the pipeline should be executed
on the current core to separate method.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda f14a8a7049 ipc: access _ipc through uncached memory region during ipc send
Function responsible for putting FW notifications into the
queue is shared between all cores. In this function we should
access _ipc object only through uncached memory region to not cause
random data overwrite.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda 7b564fcbd6 idc: access _ipc object through uncached memory region
Changes accesses to the _ipc object to go through uncached
memory region. This way slave cores can safely read shared_ctx
without causing random overwrite of the data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda 397c1a0d94 pipeline: move check for xrun
Moves xrun check in pipeline_trigger after checking
if this pipeline is running on current core. Only owner
of the pipeline should access its data.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda 39b59af35f idc: add missing cache invalidation
Adds missing comp_dev invalidation before accessing it.
We also need to move core check a little bit further,
since it also uses both comp_dev and pipeline objects.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 18:50:50 +01:00
Tomasz Lauda f5e9cf69e3 arch: xtensa: remove workaround for APL GCC compilation
Removes previously added workaround for APL GCC compilation.
Some of the coprocessor registers wasn't included in the
overlay. This patch will only work with the updated
xtensa-apl-overlay.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 13:54:05 +02:00
Tomasz Lauda 901be03a05 byt: update xtensa core headers
Updates xtensa core headers for byt and cht platforms.
The one previously used had wrong values for these
platforms.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 13:54:05 +02:00
Tomasz Lauda 312a7cdaee byt: cht: disable FIR and IIR components
Disables FIR and IIR components for byt and cht
platforms. These are not currently used, so we
can spare some space in IRAM.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 13:54:05 +02:00
Tomasz Lauda 5efd0c5e81 platform: byt: do not use vector addresses from core-isa.h
This patch copies vector addresses for baytrail platform
from core-isa.h to memory.h. This way we won't overwrite
default xtensa addresses, when updating xtensa headers.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-06 13:54:05 +02:00
Bartosz Kokoszko bdde5013e1 host: add traces with id's
Traces with id's help to read logs,
especially when there are several
pipelines in topology.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2019-08-06 11:48:03 +02:00
Tomasz Lauda d0d4301c9c task: abstract slave core functions to arch layer
Abstracts slave core functions to arch layer. It doesn't
make sense to compile them, if they won't be used.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-05 13:59:10 +01:00
Tomasz Lauda f068ddd771 ll_schedule: fix possible race condition
Fixes very rare race condition, when multiple cores
schedule something in low latency scheduler. We should
allow for timer client to execute one more time after
being cancelled. There won't be any tasks on the list
to process, but at least we will stop everything
gracefully.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-05 13:56:10 +01:00
Tomasz Lauda ca45e75244 ll_schedule: zero queue by default
Changes ll_schedule_data allocation function from malloc
to rzalloc. It should be zeroed out in order to prevent
usage of any garbage data after slave core reenable
sequence.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-05 13:56:10 +01:00
Janusz Jankowski f837e57b6e test: mux calc_sample_s16le
Unit tests for calc_sample_s16le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski 1bf779eef7 test: mux calc_sample_s24le
Unit tests for calc_sample_s24le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski 21375d45a2 test: mux calc_sample_s32le
Unit tests for calc_sample_s32le with up to 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski cfa339fece test: mux_prepare
Unit tests for mux prepare with valid and invalid formats.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski b5654b851f test: demux_copy
Unit tests for demux copy with 1 source, 4 sinks and 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Janusz Jankowski a4dcabcfc6 test: mux_copy
Unit tests for mux copy with 4 sources, 1 sink and 8 channels.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-08-02 13:31:44 +02:00
Tomasz Lauda d5a10013aa dw-dma: prevent from double stop sequence
Adds check in dw-dma to make sure the channel is in fact
in active state before doing anything.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
2019-08-02 13:06:36 +02:00
Paul Olaru 3ed68f15af panic: Distinguish exceptions from other panics
On exceptions and panics, the code will reach panic_rewind. That
function will, among the other things it needs to do to dump the info,
will also dump the exception cause (exccause register). This means that
normally coredumps from panics and those from exceptions are
indistinguishable.

In this commit I reserve the maximum value for exccause (63) to signify
that the dump actually came from a panic instead of a hardware
exception. The easiest way I could see that would not duplicate code is
to simply set the exccause register to this reserved value (otherwise it
could be undefined, as it's not initialized at boot).

I also update the core dumper tool to use 63 as the value reserved for
panics instead of 0 (which is IllegalInstructionCause, a valid hardware
exception).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-08-01 14:17:18 +02:00
Zhang Keqiao 2d0759dd02 topology: add demux pipeline to CML max98357a tplg
This topology will add a mux pipeline to support echo reference for CML.

Signed-off-by: Zhang Keqiao <keqiao.zhang@linux.intel.com>
2019-08-01 07:05:27 +02:00
Paul Olaru 9d28da9c98 arch: xtensa: Fix exception handlers
Before the commit the C exception handler table was declared empty
(suspiciously). This also caused my own tests to fail to call the panic
code whenever an exception occurred.

This commit fixes this by actually declaring the slots themselves and
initializing them to xtos_p_none, and also setting the correct size
(64 * 4 instead of 0).

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2019-07-31 10:27:52 +02:00
Pan Xiuli c6dd479787 [skip ci]scripts: update glib support for fuzzer
Install libglib2.0-dev with apt.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2019-07-31 07:57:36 +02:00
Marcin Rajwa 9152ba748a memory: change size of single HP buffer
This patch changes size of single HP buffer block
from 0x180 to 0x100. Smaller blocks scale better
allowing for performance improvements and more
efficient memory usage.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 22:00:04 +02:00
Marcin Rajwa ae14528327 memory: increase hpsram buffer size for CNL
This patch increases HPSRAM buffer size. This
additional space is needed for KWD functionality.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 22:00:04 +02:00
Marcin Rajwa 33388bbe56 kpb: return -EIO if copy was called with wrong state
This patch makes kpb_copy() to return -EIO
if it was called while KPB was in wrong state.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa e7db11b6af kpb: fix states at prepare time
This patch switches KPB into RUN state after
prepare. This is expected state once KPB
was properly initialized.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa 5e3b739043 kpb: disable sys_agent before draining
Draining task can take a long time depending
on various params. This patch disables system
agent which raises DSP PANIC in case firmware
is hanged. However draining task can look to
system agent in exactly the same manner thus
we disable it right before draining task and
reenable after draining is done.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa ad59cf465a kpb: forbid draining requests bigger than history_buffer
This patch adds a check if history depth request is
bigger than history buffer size. If so refuse to drain.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa 3bdc499467 kpb: update kpb_copy_samples() to support 24b samples
This patch updates function kpb_copy_samples() which
copies samples from KPB source buffer to sink buffer
to support 24b & 32b samples.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa dc8679aaca kpb: update kpb_drain_samples() to support 24b samples
This patch updates function kpb_drain_samples() which
copies samples from history buffer to host buffer
to support 24b & 32b samples.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa 2abe83886c kpb: take care of real time stream during draining
This patch checks if real time stream provided new data
while we were draining. If so we need to continue
draining that new data which are wainiting in history
buffer.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00
Marcin Rajwa 68c2cf87e2 kpb: change kpb buffer if at the end od draining r_ptr == buff->end_addr
This patch takes care of changing kpb buffer if last
drained size made read pointer equal to buffer
end address. This is important since in slow draining
cases we might need to update history size by real
time stream and therefore continue draining.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2019-07-30 21:49:58 +02:00