lx_emul: invalidate cache for DMA-read only

After a DMA transaction do only invalidate cachelines from the
corresponding DMA buffers if data got transfered from device to
CPU, and not vice versa. Otherwise it might result in data corruption.

Ref #4268
This commit is contained in:
Stefan Kalkowski 2021-09-23 16:43:03 +02:00 committed by Norman Feske
parent d8c344f6b9
commit 2ac8620f44

View File

@ -100,6 +100,9 @@ void dma_unmap_sg_attrs(struct device * dev,
int i;
struct scatterlist *sg;
if (dir != DMA_FROM_DEVICE)
return;
for_each_sg(sgl, sg, nents, i) {
lx_emul_mem_cache_invalidate(page_address(sg_page(sg)) + sg->offset,
sg->length);