This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 74e692b stm32f7:sdmmc invalidate before DMA to avoid eviction overwrite 74e692b is described below commit 74e692b3c12836a8297e09b9f22c91b7469fe0ac Author: David Sidrane <david.sidr...@nscdg.com> AuthorDate: Wed Dec 15 11:25:15 2021 -0800 stm32f7:sdmmc invalidate before DMA to avoid eviction overwrite For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen https://github.com/PX4/NuttX/pull/175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency. --- arch/arm/src/stm32f7/stm32_sdmmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/src/stm32f7/stm32_sdmmc.c b/arch/arm/src/stm32f7/stm32_sdmmc.c index 0d7968c..0350c17 100644 --- a/arch/arm/src/stm32f7/stm32_sdmmc.c +++ b/arch/arm/src/stm32f7/stm32_sdmmc.c @@ -3115,6 +3115,8 @@ static int stm32_dmarecvsetup(FAR struct sdio_dev_s *dev, { priv->rxbuffer = buffer; priv->rxend = buffer + buflen; + up_invalidate_dcache((uintptr_t)priv->rxbuffer, + (uintptr_t)priv->rxend); } /* Start the DMA */