| 211243b6 | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: test_bin: Add tests for offsets > 0xffff
Add test cases for using the new long-offset block types to patch memory that is >0xffff from the algorithm base.
This is just adding entr
firmware: cs_dsp: test_bin: Add tests for offsets > 0xffff
Add test cases for using the new long-offset block types to patch memory that is >0xffff from the algorithm base.
This is just adding entries to the parameter data that have larger offset values.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-9-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 7fecf0bf | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: test_bin: Run test cases on long-offset blocks
Run the patch block test cases using the new long-offset block type.
This adds a new set of parameterization that uses cs_dsp_mock_b
firmware: cs_dsp: test_bin: Run test cases on long-offset blocks
Run the patch block test cases using the new long-offset block type.
This adds a new set of parameterization that uses cs_dsp_mock_bin_add_patch_off32() to create the patch blocks in the test bin file.
The test cases for Halo Core with V3 file format include another run of the tests with the new parameterization, so that the tests are run on the standard blocks and the long-offset blocks.
This commit does not add any new cases for offsets > 0xffff.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-8-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 6e60c6aa | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: test: Increase size of XM and YM on Halo Core
Increase the size of the XM and YM regions in the mock Halo Core register map for testing patch blocks with 32-bit offsets.
Signed-of
firmware: cs_dsp: test: Increase size of XM and YM on Halo Core
Increase the size of the XM and YM regions in the mock Halo Core register map for testing patch blocks with 32-bit offsets.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-7-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 880f1eb5 | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: mock_bin: Add function to create long-offset patches
Add cs_dsp_mock_bin_add_patch_off32(). This is the same as cs_dsp_mock_bin_add_patch() except that it puts the offset in the ne
firmware: cs_dsp: mock_bin: Add function to create long-offset patches
Add cs_dsp_mock_bin_add_patch_off32(). This is the same as cs_dsp_mock_bin_add_patch() except that it puts the offset in the new 32-bit offset field and modifies the block type to indicate that it uses the long offset.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-6-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 9e6f4c5b | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: mock_bin: Pass offset32 to cs_dsp_mock_bin_add_raw_block()
Add an argument to cs_dsp_mock_bin_add_raw_block() to pass a 32-bit offset, and change the type of the existing offset ar
firmware: cs_dsp: mock_bin: Pass offset32 to cs_dsp_mock_bin_add_raw_block()
Add an argument to cs_dsp_mock_bin_add_raw_block() to pass a 32-bit offset, and change the type of the existing offset argument to u16.
The cs_dsp_test_bin_error.c test uses cs_dsp_mock_bin_add_raw_block() so it needs corresponding updates to pass 0 as the 32-bit offset.
Version 1 and 2 of the bin file format had a 16-bit offset on blocks and the sample rate field of the blocks was not used. Version 3 adds new block types that change the old sample rate field to be a 32-bit offset with the old offset currently unused.
cs_dsp_mock_bin_add_raw_block() doesn't attempt to do any magic - its purpose is to create a raw block exactly as specified by the calling test code. So the test case can pass a value for both offset fields.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-5-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| a01816ed | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: test_bin: Make patch function a test parameter
Make the call to cs_dsp_mock_bin_add_patch() a function pointer in the test case parameters, instead of calling it directly.
This is
firmware: cs_dsp: test_bin: Make patch function a test parameter
Make the call to cs_dsp_mock_bin_add_patch() a function pointer in the test case parameters, instead of calling it directly.
This is to allow for future parameterization by which function to call to add a patch.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-4-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| f4ba2ea5 | 23-May-2025 |
Jaroslav Kysela <perex@perex.cz> |
firmware: cs_dsp: Fix OOB memory read access in KUnit test (ctl cache)
KASAN reported out of bounds access - cs_dsp_ctl_cache_init_multiple_offsets(). The code uses mock_coeff_template.length_bytes
firmware: cs_dsp: Fix OOB memory read access in KUnit test (ctl cache)
KASAN reported out of bounds access - cs_dsp_ctl_cache_init_multiple_offsets(). The code uses mock_coeff_template.length_bytes (4 bytes) for register value allocations. But later, this length is set to 8 bytes which causes test code failures.
As fix, just remove the lenght override, keeping the original value 4 for all operations.
Cc: Simon Trimmer <simont@opensource.cirrus.com> Cc: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: Richard Fitzgerald <rf@opensource.cirrus.com> Cc: patches@opensource.cirrus.com Cc: stable@vger.kernel.org Signed-off-by: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250523154151.1252585-1-perex@perex.cz Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| d979b783 | 23-May-2025 |
Jaroslav Kysela <perex@perex.cz> |
firmware: cs_dsp: Fix OOB memory read access in KUnit test (wmfw info)
KASAN reported out of bounds access - cs_dsp_mock_wmfw_add_info(), because the source string length was rounded up to the alloc
firmware: cs_dsp: Fix OOB memory read access in KUnit test (wmfw info)
KASAN reported out of bounds access - cs_dsp_mock_wmfw_add_info(), because the source string length was rounded up to the allocation size.
Cc: Simon Trimmer <simont@opensource.cirrus.com> Cc: Charles Keepax <ckeepax@opensource.cirrus.com> Cc: Richard Fitzgerald <rf@opensource.cirrus.com> Cc: patches@opensource.cirrus.com Cc: stable@vger.kernel.org Signed-off-by: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250523155814.1256762-1-perex@perex.cz Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 42ae6e25 | 11-Feb-2025 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
firmware: cs_dsp: test_control_parse: null-terminate test strings
The char pointers in 'struct cs_dsp_mock_coeff_def' are expected to point to C strings. They need to be terminated by a null byte. H
firmware: cs_dsp: test_control_parse: null-terminate test strings
The char pointers in 'struct cs_dsp_mock_coeff_def' are expected to point to C strings. They need to be terminated by a null byte. However the code does not allocate that trailing null byte and only works if by chance the allocation is followed by such a null byte.
Refactor the repeated string allocation logic into a new helper which makes sure the terminating null is always present. It also makes the code more readable.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Fixes: 83baecd92e7c ("firmware: cs_dsp: Add KUnit testing of control parsing") Cc: stable@vger.kernel.org Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Tested-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250211-cs_dsp-kunit-strings-v1-1-d9bc2035d154@linutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| ee37bc7e | 19-Dec-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Delete redundant assignments in cs_dsp_test_bin.c
Delete two redundant assignments in cs_dsp_test_bin.c.
Unfortunately none of W=1 or the static analysis tools I ran flagged these
firmware: cs_dsp: Delete redundant assignments in cs_dsp_test_bin.c
Delete two redundant assignments in cs_dsp_test_bin.c.
Unfortunately none of W=1 or the static analysis tools I ran flagged these.
Fixes: dd0b6b1f29b9 ("firmware: cs_dsp: Add KUnit testing of bin file download") Reported-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com> Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602511 Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602490 Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241219155719.84276-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 644115e8 | 17-Dec-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Fix endianness conversion in cs_dsp_mock_wmfw.c
In cs_dsp_mock_wmfw_add_coeff_desc() the value stored in longstring->len needs a cpu_to_le16() conversion.
Fixes: 5cf1b7b47180 ("fi
firmware: cs_dsp: Fix endianness conversion in cs_dsp_mock_wmfw.c
In cs_dsp_mock_wmfw_add_coeff_desc() the value stored in longstring->len needs a cpu_to_le16() conversion.
Fixes: 5cf1b7b47180 ("firmware: cs_dsp: Add mock wmfw file generator for KUnit testing") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202412170233.8DnsdtY6-lkp@intel.com/ Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241217105624.139479-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| b0e4e203 | 16-Dec-2024 |
Arnd Bergmann <arnd@arndb.de> |
firmware: cs_dsp: avoid large local variables
Having 1280 bytes of local variables on the stack exceeds the limit on 32-bit architectures:
drivers/firmware/cirrus/test/cs_dsp_test_bin.c: In functio
firmware: cs_dsp: avoid large local variables
Having 1280 bytes of local variables on the stack exceeds the limit on 32-bit architectures:
drivers/firmware/cirrus/test/cs_dsp_test_bin.c: In function 'bin_patch_mixed_packed_unpacked_random': drivers/firmware/cirrus/test/cs_dsp_test_bin.c:2097:1: error: the frame size of 1784 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Use dynamic allocation for the largest two here.
Fixes: dd0b6b1f29b9 ("firmware: cs_dsp: Add KUnit testing of bin file download") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241216121541.3455880-1-arnd@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 75a4a6ef | 12-Dec-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Add KUnit testing of client callbacks
Test that the cs_dsp_client_ops callbacks are called when expected.
pre_run, post_run - when cs_dsp_run() is called. pre_stop, post_stop - wh
firmware: cs_dsp: Add KUnit testing of client callbacks
Test that the cs_dsp_client_ops callbacks are called when expected.
pre_run, post_run - when cs_dsp_run() is called. pre_stop, post_stop - when cs_dsp_stop() is called control_add - when a WMFW is loaded control_remove - when cs_dsp_remove() is called
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241212143725.1381013-13-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| feb5fb06 | 12-Dec-2024 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Add KUnit testing of wmfw error cases
Add tests for various types of errors and illegal values in wmfw files. This covers buffer overflows as well as general unsupported field valu
firmware: cs_dsp: Add KUnit testing of wmfw error cases
Add tests for various types of errors and illegal values in wmfw files. This covers buffer overflows as well as general unsupported field values.
There are several sets of test cases to cover various different versions of the wmfw file format.
V0 format was only used on the earlier ADSP2 devices. It does not have algorithm blocks.
V1 format is used on all ADSP2 versions. It added algorithm blocks and firmware coefficient descriptor blocks. Strings are stored in fixed-length arrays.
V2 format is used on all ADSP2 versions. It is similar to V1 but space for strings is variable-length with either an 8-bit or 16-bit length field.
V3 format is used on Halo Core DSPs and is mostly identical to the V3 format.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20241212143725.1381013-12-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|