Commit Graph

9969 Commits

Author SHA1 Message Date
Andy Ross 7f02b0b30b ipc4: Quiet errors when fuzzing
Fuzzing produces (by design) an endless flood of protocol errors.
Quiet the top level ones when in use, because otherwise the log output
takes up most of the CPU time available that we'd rather spend on
fuzzing.  Same trick from IPC3.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross deefe40f0d platform/posix: IPC4 updates
Don't use the IPC3 protocol whiteboxing for IPC4, the formats are
different.

Also IPC4 seems to send a LOT of zero-length empty replies.  Those are
causing spurious errors (memcmp_s fails when you pass it a null
destination pointer, even when the length is zero), where the Intel
IPC driver will just drop them.  Suppress handling to match behavior,
though this is probably a buglet worth investigating.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross 3f817fd192 platform/posix: Update for IPC4
Add new APIs needed for CONFIG_IPC_MAJOR_4=y builds.  Note that many
of these are fairly Intel-specific, meaning they probably don't belong
in the platform layer.  But in this case (fuzzing) it's probably
worthwhile to enable as much code as possible vs. refactoring for
purity.  Future IPC4 hardware platforms will need to do that
refactoring for us anyway.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross c542db3466 ipc4: Clean up Intel/rimage dependencies
The component model for IPC4 seems to be based on an array of manifest
headers at the start of the firmware image.  Those are rimage data,
and not all platforms (in particular the fuzzer) are packing their
output with rimage.

Just stub this for now.  In the source tree as it exists, there don't
seem to be any extra components to build, nor is there any support I
can see at the linker/rimage level to get them included anyway.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross 2897d4029f base_fw: No Intel register reads in non-platform code
This was trying to read hardware registers, which obviously doesn't
work on other platforms.  Stub with zeros for now.

Longer term: this whole message ("basefw_mem_state_info") might want
some rework.  In addition to being heavily hardware-specific, it seems
like a comparatively large block without self-describing data
(e.g. id/val pairs), nor with a struct definition to specify it, nor
with any documentation that I can find.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross bffe168d89 init.c: Missing header
This calls mailbox APIs when building for IPC4, but was missing the header

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross 043bef37d6 base_fw: Add missing header
CLK_MAX_CPU_HZ is defined in platform/lib/clk.h, unmasked by posix
work that lacks the same transitive headers.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Andy Ross 483c78fa5c ipc4: Clean up toolchain definitions
__packed and __aligned are defined in compiler_attributes.h, which
wasn't included, and when building for Zephyr that needs to include
the zephyr/toolchain.h header which is the original source of those
macros.

Transitive headers were saving this, but building for posix/fuzzing
works differently.

Signed-off-by: Andy Ross <andyross@google.com>
2023-05-09 12:17:44 +03:00
Yong Zhi 04749b9c41 topology2: dmic-generic: add macro for DMIC_CORE_ID
Add macros to quickly enable multi-core with DMICs.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2023-05-08 19:55:02 -07:00
Bard Liao a3cb46d8c0 topology2: cavs-sdw: make jack optional
We assume sdw jack is always there in a sdw topology. This commit
makes it be optional to deal with the sdw amp only case.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2023-05-08 09:17:44 -07:00
Ranjani Sridharan 54c65b9b0d ipc4: dai: No need to unregister DMA copy notifier
It is not needed for IPC4.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 262c2a6893 copier: remove endpoint DAI device creation for single endpoint DAIs
Remove the creation or the endpoint DAI device when a copier have only a
single endpoint. Replace the usage of the endpoint device with the
copier device and remove the endpoint buffer. Amend the copier_params()
to pass the appropriate params for the DMA buffer and set the correct
processing function in the case where the valid bits and the container
size do not match.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan dc41f39009 dai-zephyr/dai-legacy: Use comp_dai_get_hw_params()
So that the correct op will be invoked when this function is invoked
with a copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan f6e2ee4520 component-ext: Remove comp_get_dai()
The dai_data can simply be accessed via the copier_data. There is no
copier with chain DMA anymore, so no need to special handle that case
in pipeline_comp_trigger() either.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 570622b9b9 copier: Add dai_get_hw_params op
In preparation to remove the DAI device creation for DAI copiers, add
the dai_get_hw_params op and expose dai_zephyr_get_hw_params() for both
dai-zephyr and dai-legacy.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 2887a0e51f dai-legacy/dai-zephyr: Split the timestamping ops
In preparation to remove the DAI device creation, add the timestamping
ops for the DAI copier and expose the timestaming functions in
dai-zephyr and dai-legacy.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 74f324641a topology2: cavs-nocodec: add a module copier to SSP 0 capture pipeline
Add a module copier between the DAI copier and gain in preparation for
optimizing the single endpoint DAI copiers. This optimization will
temporarily make multiple sinks unsupported with DAI copiers. This
feature will be re-introduced in a follow up PR and the module copier
will be removed then.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 59c343fcc7 dai-zephyr: Modify the signature of comp_dai_config() op
In order to also use this function from the copier device without an
endpoint DAI device, modify the signature to ass both the dai_data and
the dev pointers. Also, modify the signatures of dai_assign_group() and
dai_init_llp_info() to use the passed pointers.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 44374e7e3a dai-zephyr: Expose dai_zephyr_copy()
Expose and use the function for the single endpoint DAI coper case in
preparation to remove the creation of the DAI device.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 972c7f1545 dai-zephyr/dai-legacy: Split up dai_copy()
Add a helper function, dai_zephyr_copy() that can also be called from a
copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 9cd7f38973 dai: Modify the signature of dai_dma_position_update()
Pass both the dai_data and the dev pointers so that it can also be used
from the copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 286da916ea dai-zephyr: Expose dai_zephyr_params()
Expose and use it in the single endpoint DAI case in the copier device
in preparation to remove the creation of dai component.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 897fee7d78 dai-zephyr/dai-legacy: Split up dai_params()
Add a new helper, dai_zephyr_params() to make it usable from the copier
device. Also modify the signatures of dai_playback_params() and
dai_capture_params() to use the passed dai_data and dev pointer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan fb0441760d dai: Modify the signature of ipc_dai_data_config()
To pass both the dai_data and dev pointer and make it usable for both
the DAI device and the copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 20d84ce4ea ipc4: dai: Expose dai_zephyr_position()
Expose and use the function in the copier.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 8dd0adcd33 ipc4: dai: Split up dai_position()
And add a new helper, dai_zephyr_position() that can also be used by the
copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan b74895c193 copier: Modify get_processed_data()
Modify the get_processed_data() function to use the total_processed_data
from the dai_data directly for DAI components.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 066e7d70f4 dai-zephyr/dai-legacy: Expose dai_zephyr_trigger()
Expose and use the function in the single endpoint DAI case in the
copier device in preparation to remove the creation of DAI component.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 89764c048f dai-zephyr/dai-legacy: Split up dai_comp_trigger()
Add a new helper function dai_zephyr_trigger() that can also be used by
a copier device. Also, modify the signature of the
dai_comp_trigger_internal() to pass the dai_data and device pointer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian a281224e15 dai-zephyr/dai-legacy: Expose dai_zephyr_reset()
Expose dai_zephyr_reset() and use in the copier device for the single
endpoint case in preparation for removing the creation of DAI component.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 138fa449f7 dai-zephyr/dai-legacy: Split up dai_reset()
And add a helper function, dai_zephyr_reset() that can also be used by
the copier device in the next patch.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan b127cc7e77 dai: Modify the signature of dai_dma_release()
In preparation for it to be used with both the DAI device and the copier
device, pass both the dai_data and the device pointer separately.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian 79c4339489 dai-zephyr/dai-legacy: Expose dai_zephyr_prepare() and dai_zephyr_config_prepare()
Rename dai_config_prepare() to add the zephyr prefix and expose both
functions and use them in the copier device in the single endpoint DAI
case.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 9da71a8708 dai-zephyr/dai-legacy: split the dai_prepare() function
Split the dai_prepare() function and add a new helper,
dai_zephyr_prepare() that can also be invoked from the copier device.
Also modify the dai_config_prepare() function to pass the dai_data and
device separately for use with the copier device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Baofeng Tian c8dc91ea53 copier: Expose dai_zephyr_new()/free()
Expose the dai_zephyr_new()/free() functions and use them for
creating/freeing the endpoint device when the dai_count is 1 when a
copier device is created. This is preparation to replace the endpoint
device with the copier device and eventually remove the endpoint device
itself.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan d968578882 dai: Modify the signature of dai_config_dma_channel()
In preparation for this function to be used by both a copier device and
the DAI device, modify the signature to pass both the dai_data and the
device pointer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan b31d2a1595 dai-zephyr/dai-legacy: Split the dai_free() function
Split the dai_free() function to add a helper function, dai_zephyr_free()
in preparation for this to be called from both a DAI device and copier
device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan f7e47aa6af dai-zephyr/dai-legacy: Split the dai_new() function
Split the dai_new() function to add a helper function, dai_zephyr_new()
in preparation for this to be called from both a DAI device and copier
device.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Ranjani Sridharan 39f81954c4 dai: Modify the signature of dai_release_llp_slot()
In preparation for using this function for both a DAI device and a
copier device, modify the signature to pass the dai_data as the input
instead of the dev pointer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-08 12:23:52 +03:00
Marc Herbert de6690f104 .github: upgrade most runners to latest Ubuntu 22.04
Let's not fall behind.

Ubuntu 22.04 is the latest runner offered by Github:
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-08 12:21:55 +03:00
Andrula Song 523fe82732 Smart_amp: Convert IPC4 dummy smart_amp component to use the module adapter
Convert the IPC4 dummy smart_amp(smart_amp_test_ipc4.c) module to use
module adapter interface. And remove the k_mutex lock from struct
smart_amp_data since the lock is used for bind/unbind thread and process
thread. Now bind/unbind are removed, all lock reference is used in the same
thread so we don't need it anymore.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-05-08 12:21:14 +03:00
Andrula Song 460bca5402 Smart_amp: Remove the k_mute lock of IPC3 implementation
Since smart_amp_test will always start feedback path firston IPC3
and the k_mute lock is added for IPC4 to support arbitrarily order
of starting source path and feedback source. So remove the k_mute
from IPC3 implementation.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-05-08 12:21:14 +03:00
Andrula Song 250a17c449 Smart_amp: Split dummy smart_amp to IPC3/IPC4 version
Split smart_amp_test.c to IPC3 version smart_amp_test_ipc3.c
and IPC4 version smart_amp_test_ipc4.c

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-05-08 12:21:14 +03:00
Marc Herbert 3f24c05ab2 .gitmodules: add comments about relative URL. No change.
Answering a question from @ceolin and others before him.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-08 12:19:17 +03:00
Ranjani Sridharan 3c39c2c996 topology2: cavs-sdw: Enable PDM 1 mics for 4ch
It would be better to make these dependedent on NUM_DMICS. Something to
improve in a follow up PR.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-05-05 19:42:29 +03:00
Marc Herbert a4ece86d4d xtensa-build-zephyr.py: drop intermediate build-$platf/sof-$platf.ri
Remove one intermediate and unnecessary .ri file. Simplify the code and
the build directory. Example below with `sof-mtl.ri` for better
readability but this applies the same to `sof-imx8.ri` and every other
`sof-$platf.ri` file.

There were 3 .ri copies before this commit:

```
                build-mtl/zephyr/zephyr.ri
copied to  ->   build-mtl/zephyr/sof-mtl.ri
copied to  ->   build-sof-staging/___/sof-mtl.ri
```

Only 2 left after dropping the second and pointless copy:

```
                build-mtl/zephyr/zephyr.ri
copied to  ->   build-sof-staging/___/sof-mtl.ri
```

Fewer copies means less wondering about what is what, two identical
files in the same directory is at best pointless and at worst misleading.

The `build-mtl/` directory belongs to the zephyr build system
exclusively, this wrapper script has no business interfering with
`build-mtl`. `build-mtl/zephyr/sof-mtl.ri can even be dangerous because
it does not get cleaned. Demonstration:

```
 # Compile successfully
 $ ./scripts/xtensa-build-zephyr.py mtl

 # Write some code and make a mistake.
 # Fail to compile.
 $ echo BROKEN >> ../zephyr/kernel/sched.c
 $ ./scripts/xtensa-build-zephyr.py mtl

 # Obsolete .ri files are still there
 $ find ../build-mtl/ -name *.ri
  ../build-mtl/zephyr/zephyr.ri
  ../build-mtl/zephyr/sof-mtl.ri

 $ ninja -C ../build-mtl clean

 # Obsolete sof-mtl.ri is still there!
 $ find ../build-mtl/ -name *.ri
  ../build-mtl/zephyr/sof-mtl.ri

```

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-05-05 19:40:58 +03:00
Serhiy Katsyuba 9c98cfd611 ipc4: Fix Host gtw conversion to/from 24_4LE audio
Fixes audio format conversions on Host gateway between 16/16 and 24/32
(and vice versa) and between 32/32 and 24/32 (and vice versa).

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-05-05 09:13:57 -07:00
Seppo Ingalsuo 43b08c62b5 Tools: Test: Audio: Convert tabs to spaces in comp_run.sh
No script changes, just unify shell script style to be
with indents with spaces instead of both tabs and spaces.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00
Seppo Ingalsuo b4af9d93a1 Tools: Test: Changes for process_test.m run with xt-xcc
This patch adds to process_test() sixth argument to run the tests
with xt-run environment with argument set to 'xt-run' or
'xt-run --turbo'.

The set and print of LD_LIBRARY_PATH is no more needed with static
testbench version.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00
Seppo Ingalsuo 10d0b3b5e1 Scripts: Add xt-run build target for rebuild-testbench.sh
This patch adds to rebuild-testbench option -x <platform> that
can be used to build testbench for xt-run execution. The enhanced
script reuses native testbench build but with CC, LD, LDFLAGS,
etc. defines to use the xt-xcc compiler for build.

Currently TGL (HiFi3) is the only supported platform. More will
be added later.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2023-05-04 18:07:52 +03:00