Commit Graph

63 Commits

Author SHA1 Message Date
Jaska Uimonen 18ce85c201 tests: intel_adsp: ssp: fix dma data sizes
Dma data sizes were incorrect causing segfault in the test, thus fix
them.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-07 01:23:01 -08:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Adrian Warecki aac03280ec dma: dts: Rename of the dma_buf_alignment to dma-buf-addr-alignment
Renamed the dma-buf-alignment field to a more explicit
and descriptive name dma-buf-addr-alignment.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-11-23 15:36:31 -05:00
Kumar Gala ba0617417a tests: intel_adsp: smoke: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus().  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 09:54:22 -04:00
Kumar Gala a1195ae39b smp: Move for loops to use arch_num_cpus instead of CONFIG_MP_NUM_CPUS
Change for loops of the form:

for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
   ...

to

unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
   ...

We do the call outside of the for loop so that it only happens once,
rather than on every iteration.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-21 13:14:58 +02:00
Andrey Borisovich 56e1c5061d soc: ace: add external IPC completion to ipc done handler
Sometimes IPC message acknowledgement should be done by external
code to provide sufficient timing (example assemble code related
to powering down). Added bool return type to ipc message done handler
that if callback function returns true, IPC API skips writing
IPC message completion bits.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-10-20 18:52:42 -04:00
Kumar Gala 4f0166088c tests: move to using CONFIG_MP_MAX_NUM_CPUS
For tests that set CONFIG_MP_NUM_CPUS, switch to using
CONFIG_MP_MAX_NUM_CPUS instead as we work to phase out
CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-20 22:04:10 +09:00
Kumar Gala c778eb2a56 smp: Move arrays to use CONFIG_MP_MAX_NUM_CPUS
Move to use CONFIG_MP_MAX_NUM_CPUS for array size declarations instead
of CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-17 14:40:12 +09:00
Daniel Leung ff46de7838 tests: intel_adsp/smoke: wait longer for sched IPI
This lengthens the CPU_IPI_DELAY as some hardware require
a bit more time for IDC to propagate.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-10-07 18:12:34 -04:00
Ederson de Souza 0e6aee3479 tests/boards/intel_adsp: Add cache related tests
Tests that exercise z_xtensa_cache_[flush|inv|flush_inv]_all()
functions.

These tests are at board level because what is mapped into memory is
SoC/board dependent - no one wants side effects due writing to some
inappropriate address.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-10-07 17:48:39 -04:00
Tom Burdick 9b3a2f1938 tests: hda_log: Increase timeout for testing
The tests can take a bit of time as they try and work with real world
buffer settings and excercise wrapping the ring buffer many times. It's
important to do this as the padding and wrapping code may have sharp
edges that are better caught in a test.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-09-12 15:57:57 -04:00
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Ederson de Souza 68e8eddca6 tests/boards/intel_adsp: Fix SSP test build
Test wasn't building since 8dd57467c made Intel DAI SSP depend on power
management. This patch fix this by adding the required configs to the
test prj.conf.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza 578e8ee964 soc/xtensa/intel_adsp/cavs: Fix CPU sporadically not idling
Sometimes, on CAVS 25, the CPU may fail to idle. This was due a failure
during test initialisation - the test is supposed to run from CPU0, and
halt and restart the other ones. However, code to pin thread to CPU was
incorrect - a running thread can't be pinned to a CPU (the
k_thread_cpu_mask* calls were returning error).

This patch solves this by creating a thread that is pinned to CPU0
before it is run.

While at it, add some more checks for returned values.

Fixes: #49790

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 16:23:29 -04:00
Tom Burdick 54474510b3 logging: adsp hda backend refinements and additional test
Additional testing showed that when using printk the logger would start
sticking and spitting out nulls which is wrong. This made it appear as if
the firmware had locked up. The issue seems to have been caused by the
initial ipc message to read all the dma buffers on the host.

Removing that, the issue seems to have been solved.

This also improves the test case to ensure printk with LOG_PRINTK=y
works as expected. It also adds a last log message between some
timeouts of the flush timer length to ensure the padding and timer
flush are working properly.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-09-07 20:27:44 -04:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Andrey Borisovich 2e04bfdfe0 soc: intel_adsp: Refactored IPC/IDC
Changes to code:
1. Renamed CAVS_IPC API from common/include/cavs_ipc.h to
common/include/intel_adsp_ipc.h. Renamed all API functions and structs -
added "intel_adsp_" prefix.
2. Moved definitions from intel-ipc-regs.h and ace-ipc-regs.g to SOC
specific headers include/<soc_name>/adsp_ipc_regs.h.
3. Added new common intel_adsp_ipc_devtree.h header with new
macros to retrieve IPC and IDC nodes and register addresses.
Put those new macros in code replacing hardcoded values outside of
devicetree.
4. Changed documentation of IDC and renamed IDC register struct
to have common name between all intel adsp socs.
5. Removed excessive docs description on cAVS IPC protocol.

Changes to Devicetree:
1. Renamed in all CAVS boards .dtsi files content in IPC nodes:
   - "cavs_host_ipc" node labels to "adsp_ipc" labels.
   - compatible "intel,cavs-host-ipc" renamed to
     "intel,adsp-host-ipc".
2. Added (previously missing) yaml file for "intel,adsp-host-ipc"
   compatible.
3. Renamed in all CAVS boards .dtsi files content in IDC nodes:
   - "idc" node labels to "adsp_idc" labels.
   - compatible "intel,cavs-idc" renamed to "intel-adsp-idc"
4. Renamed intel,cavs_idc.yaml file to intel,adsp_idc.yaml
   so it is suitable for both CAVS and ACE SoC family.
   Moved it from ipm bindings to ipc bindings where it belongs.

Changes to Kconfig:
1. Renamed existing Kconfig option CONFIG_CAVS_IPC to
   INTEL_ADSP_IPC.
2. For renamed INTEL_ADSP_IPC addded default value based on
   status of the "adsp-ipc" and "adsp-ipc" node.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-09-02 08:18:32 -04:00
Tom Burdick 3a4864bdd2 logging: adsp hda backend improvements
* Adds a default hook and init function for cavstool.
* Adds an optional padding on flush feature to ensure all data is written.
* Fixes an error in cavstool.py for correctly wrapping the ring buffer.
* The test case now ensures wraps and flushes occur numerous times.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-26 21:33:10 -04:00
Enjia Mai 81311a0b02 tests: boards: intel_adsp: move the hda test to new ztest API
Migrate the testsuite tests/boards/intel_adsp/hda to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-22 16:37:25 +00:00
Enjia Mai fab3438556 tests: boards: intel_adsp: move the hda_log test to new ztest API
Migrate the testsuite tests/boards/intel_adsp/hda_log to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-22 16:37:25 +00:00
Enjia Mai aa95e4e051 tests: boards: intel_adsp: move the smoke test to new ztest API
Migrate the testsuite tests/boards/intel_adsp/smoke to the new
ztest API.

Also splitting them into 2 test suites can be run independently.
But the boot test has a strict order so we changed the name of
the test cases to keep them running in a specified order.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-22 16:37:25 +00:00
Enjia Mai 6db5e59af2 tests: boards: intel_adsp: move the ssp test to new ztest API
Migrate the testsuite tests/boards/intel_adsp/ssp to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-22 16:37:25 +00:00
Enjia Mai c895d33ebf tests: boards: intel_adsp: move the mm test to new ztest API
Migrate the testsuite tests/boards/intel_adsp/mm to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-22 16:37:25 +00:00
Gerard Marull-Paretas 979fcc6fe8 tests: boards: intel_adsp: initialize devices at compile time
Initialize devices at compile time so that pointer can be constified.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Tom Burdick efc0928570 dma/hda: Use the correct register block size for each IP block
Previous versions were using, incorrectly, the host in/out regblock size
of 40 bytes for all peripherals when in fact the link in/out regblock size
is 20 bytes in size.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-18 14:54:57 -05:00
Katarzyna Giadla eae01f0fc5 samples: tests: Rename duplicated testcases
Names of some testcases are duplicated in another files.
This change rename duplicated testcases.

Signed-off-by: Katarzyna Giadla <katarzyna.giadla@nordicsemi.no>
2022-08-17 12:11:00 +02:00
Fabio Baltieri def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Kumar Gala 71691e8533 tests: intel_adsp: Convert to test to use use DEVICE_DT_GET_ONE
Update test to use DEVICE_DT_GET_ONE to remove usage of
device_get_binding.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 14:31:08 +00:00
Anas Nashif 43371d0414 intel_adsp: move cavs to be a series
Intel ADSP CAVS is now a proper series with all CAVS SoCs running under
it. This will give us to Intel ADSP series:
- CAVS
- ACE v1.x

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 16:50:24 -04:00
Anas Nashif af3d5331a1 intel-adsp: migrate cavs-mem.h to adsp_memory.h
Move header and make it soc specific.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Tom Burdick ac84039060 tests: intel_adsp: Silence the hda tests
Uses a macro with a define flag to enable register dumps on the DSP
side. On the python side a simple booling flag.

The default disabled both debug flags and makes the tests
considerably quieter.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-19 16:10:47 -04:00
Tom Burdick c225cf3b8a dma: HDA rename prefix from cAVS to ADSP
HDA is a common IP used across the entire ADSP line and deserves
a name respecting that alongside similiar IP drivers such as the
ADSP GPDMA driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-14 17:53:46 +00:00
Kumar Gala 989e17a493 dma: HDA: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-13 13:11:17 -05:00
Anas Nashif 02f2896586 tests: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Ederson de Souza d497cca845 tests/boards/intel_adsp/smoke: Wait for host script to be ready
These tests work in tandem with the cavstool.py script: the script
receives IPC messages and properly acts on them. However, it may take
some time to the script execution arrive at the point in which it's
ready to receive incoming messages. This patch makes the test code wait
some arbitrary time to allow the script to reach the desired state.

Note that another IPC message could be used to this end, but since some
tests are actually testing the IPC mechanism, it seems unwise to assume
IPC works for set up steps.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-06-28 14:56:57 -04:00
Tom Burdick 81f3803927 dma: HDA DMA API test use alignment property
Use the DMA_BUF_ALIGNMENT macro and property in the hda test case.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-27 12:46:11 +02:00
Tom Burdick 1b1f0bb12b dma: HDA smoke test buffer alignment from DTS
Use the device tree defined buffer alignment for the smoke test.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-27 12:46:11 +02:00
Andy Ross 5139d052d8 tests/intel_adsp/smoke: Revert WAIT_FOR breakage
The evolution of the original WAIT_FOR trick in this test, first to
move it to a generic spot and then to make it take a delay
paramatrization, have had the unfortunate side effect of breaking the
original usage.

And... it's really not following the design intent anyway.  The idea
here was to spin hard waiting on external hardware (a python script
running on the host) to deliver an interrupt.  Both of the new tricks
(suspending the thread with a sleep and hammering the HDA wall clock
for time) can affect interrupt delivery.

Just restore the original implementation (albeit with a new name,
"AWAIT", since the original was stolen) until someone has a chance to
make this work properly with the new API.  There's no reason it can't,
it just doesn't yet.

Fixes #43828

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-06-07 18:58:00 +02:00
Ederson de Souza 3209bc1a4a soc/xtensa/intel_adsp/tools: Make cavstool.py DSP resetting more stable
When using more than one core on cavs25, some hangs were made
"persistent", as it seems not all cores were being properly reset, thus
compromising tests - if a test hangs for any reason, subsequent tests
that were not restrict to a single CPU would also fail.

This patch mitigates these issues by two changes:
  - Closely mimics SOF Linux driver way of loading the firmware. So,
    explicit stall and reset (and "unstall" and "unreset") of cores, with
    appropriate checks that states have been reached;
  - More generous sleep before resetting the stream.

Also, the status of ADSPCS (Audio DSP Control and Status) register is
logged more thoroughly to aid debugging in case new issues arise.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-06-07 11:51:37 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Tom Burdick 012836aeef tests: hda_log: cav15 timeout fixes
Fixes issues caused by the hda_log test for cavs15 caused by ipc
messaging issues. Wait for the ipc message to complete immediately after
sending it.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-05-17 11:12:57 -05:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Maureen Helm f4a0854481 drivers: dai: Use dt_compat_enabled for Intel SSP driver default
Enables the Intel SSP driver by default when the DAI driver class is
enabled (CONFIG_DAI=y) and a compatible devicetree node
("intel,ssp-dai") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-05-06 11:32:04 +02:00
Tom Burdick 6913da9ddd logging: cAVS HDA based logger
Adds a log backend that maintains a ringbuffer in coordination
with cAVS HDA.

The DMA channel is expected to be given some time after the logger
starts so a seperate step to initialize the dma channel is required.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-05-04 18:56:13 -04:00
Maureen Helm 5769dffc01 drivers: mm: Use dt_compat_enabled for Intel ADSP TLB driver default
Enables the Intel TLB driver by default when the MM driver class is
enabled (CONFIG_MM_DRV=y) and a compatible devicetree node
("intel,adsp-tlb") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-04-25 11:41:31 -07:00
Tom Burdick 2f320730a1 dma/cavs_hda: Adds link in/link out compatibles
Adds hda link in and out drivers. The link in and link
out channels of HDA have small differences
with the host channels. Updates the existing
cavs_hda drivers and code to account for these
differences.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-18 19:19:40 -04:00
Jaska Uimonen 03e335ca6a tests: drivers: ssp: add ssp dai tests
Add tests for Intel dai ssp driver. These tests configure
the ssp driver and transfer data over loopback with dma.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-04-14 11:42:08 -04:00
Jaska Uimonen 8d38b64fdc drivers: dai: add dai driver subdir and ssp driver
Add Intel ssp driver using dai interface.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-04-14 11:42:08 -04:00
Yuval Peress 5416abfe5f util: convert wait_for macro to uppercase
This macro conflicts with C++'s std::condition_variable::wait_for
and makes it very difficult to use Zephyr with C++. Replace it with
an all uppercase name which fits the naming standard better.

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-04 09:50:28 -05:00
Tom Burdick 602ef3fb0e soc/intel_adsp: Require definitions for cavs_hda.h
Rather than defining them in the header, require a set of defines
be provided to cavs_hda.h as part of the expected input to the API.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00