| 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 ...
|
| afcbb046 | 31-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: test_bin: Run test cases with v3 file format
The new v3 file format has all the same functionality as the earlier formats, so run all the existing test cases with a file type of 3.
firmware: cs_dsp: test_bin: Run test cases with v3 file format
The new v3 file format has all the same functionality as the earlier formats, so run all the existing test cases with a file type of 3. This is only done for Halo Core because v3 files are not used with the older ADSP cores.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251231172711.450024-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| ae9ccaed | 01-Dec-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Don't use __free() in cs_dsp_load() and cs_dsp_load_coeff()
Replace the __free(kfree) in cs_dsp_load() and cs_dsp_load_coeff() with a kfree(buf) at the end of the function.
The us
firmware: cs_dsp: Don't use __free() in cs_dsp_load() and cs_dsp_load_coeff()
Replace the __free(kfree) in cs_dsp_load() and cs_dsp_load_coeff() with a kfree(buf) at the end of the function.
The use of __free() can create new cleanup bugs that are difficult to spot because the defective code is idiomatically correct regular C. In these two functions the __free() was mixed with gotos, and also used the suspect declaration __free(kfree) = NULL;.
The __free() did not do anything to simplify the code. There aren't any early returns after the pointer is set, and the __free() can be replaced by a kfree() at the end of the function.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 900baa6e7bb0 ("firmware: cs_dsp: Remove redundant download buffer allocator") Link: https://patch.msgid.link/20251201160729.231867-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 479b1f8d | 28-Nov-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Add test cases for client_ops == NULL
Add test cases for the client not providing a pointer to a struct cs_dsp_client_ops. This proves that it is safe for the client to leave the c
firmware: cs_dsp: Add test cases for client_ops == NULL
Add test cases for the client not providing a pointer to a struct cs_dsp_client_ops. This proves that it is safe for the client to leave the client_ops pointer at NULL if it does not need to implement any of the callbacks.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251128102132.1575177-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| c45d5d98 | 27-Nov-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Use kvzalloc() to allocate control caches
Use kvzalloc() instead of kzalloc() to allocate memory to cache the content of a firmware control.
Most firmware controls are only small,
firmware: cs_dsp: Use kvzalloc() to allocate control caches
Use kvzalloc() instead of kzalloc() to allocate memory to cache the content of a firmware control.
Most firmware controls are only small, typically a few bytes. But on some firmware there can be much larger controls for coefficient or model data.
The overhead of kvzalloc() is negligible because most control allocs can be satisfied by the normal kmalloc() that kvzalloc() will try first.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251127103947.1094934-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 900baa6e | 26-Nov-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Remove redundant download buffer allocator
Now that cs_dsp uses regmap_raw_write() instead of regmap_raw_write_async() it doesn't need to keep multiple DMA-safe buffers of every ch
firmware: cs_dsp: Remove redundant download buffer allocator
Now that cs_dsp uses regmap_raw_write() instead of regmap_raw_write_async() it doesn't need to keep multiple DMA-safe buffers of every chunk of data it wrote.
See commit fe08b7d5085a ("firmware: cs_dsp: Remove async regmap writes")
Only one write can be in progress at a time, so one DMA-safe buffer can be re-used. The single DMA-safe buffer is reallocated if the next write chunk is larger. Reallocation size is rounded up to reduce the amount of churn. PAGE_SIZE is used as a convenient size multiple. Typically for .wmfw files the first chunk is the largest.
A DMA-safe intermediate buffer is used because we can't assume that the bus underlying regmap can accept non-DMA-safe buffers.
Note that a chunk from the firmware file cannot simply be split into arbitrarily-sized chunks to avoid buffer reallocation. The data in the firmware file is preformatted to be written directly to the device as one block. It already takes account of alignment, write-bursts and write length requirements of the target hardware, so that the cs_dsp driver can treat it as an opaque blob.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251126131501.884188-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|
| 3045e29d | 20-Nov-2025 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
firmware: cs_dsp: Append \n to debugfs string during read
Append the terminating \n to the string during the debugfs file read instead of creating a string that already has a trailing \n.
This avoi
firmware: cs_dsp: Append \n to debugfs string during read
Append the terminating \n to the string during the debugfs file read instead of creating a string that already has a trailing \n.
This avoids the ugly behaviour of having to include a trailing \n in the filenames stored to wmfw_file_name and bin_file_name in struct cs_dsp.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251120130640.1169780-3-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 ...
|