app: boards: imx95_evk: set host and edma buffer alignment to 32 #9676
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SOF performs cache invalidation operations on the DAI and HOST DMA buffers to make sure that the firmware doesn't read/write stale data in the areas shared with the DMAC and Linux. Currently, these buffers use an 8-byte alignment.
The Cortex-M7 data cache line size is 32-byte. Given this and the fact that the buffers have an 8-byte alignment what could end up happening is invalidating useful data by mistake.
In the case of imx95 what seems to happen is the allocated heap chunk headers get corrupted leading to one of the following assertions failing:
1) CHECK(b->next != 0) (from free_list_remove_bidx())
2) CHECK(chunk_size(h, c) >= sz) (from alloc_chunk())
This implies that free chunks end up in the wrong buckets.
The fix for this is to just align the DAI/HOST buffers to 32 bytes.
Note that we didn't actually catch the moment the chunk headers get corrupted. Instead, the conclusion was reached based on the following facts: