Skip to content
Unverified Commit 0c17ba73 authored by Vincent Whitchurch's avatar Vincent Whitchurch Committed by Mark Brown
Browse files

spi: Fix cache corruption due to DMA/PIO overlap



The SPI core DMA mapping support performs cache management once for the
entire message and not between transfers, and this leads to cache
corruption if a message has two or more RX transfers with both
transfers targeting the same cache line, and the controller driver
decides to handle one using DMA and the other using PIO (for example,
because one is much larger than the other).

Fix it by syncing before/after the actual transfers.  This also means
that we can skip the sync during the map/unmap of the message.

Fixes: 99adef31 ("spi: Provide core support for DMA mapping transfers")
Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20220927112117.77599-3-vincent.whitchurch@axis.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f25723dc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment