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.
This commit is contained in:
David Sidrane 2021-12-15 11:25:15 -08:00 committed by Xiang Xiao
parent 5d07dc96a8
commit 74e692b3c1

View File

@ -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 */