[PATCH 13/21] arc: dma-mapping: skip invalidating before bidirectional DMA
Arnd Bergmann
arnd at kernel.org
Mon Mar 27 05:13:09 PDT 2023
From: Arnd Bergmann <arnd at arndb.de>
Some architectures that need to invalidate buffers after bidirectional
DMA because of speculative prefetching only do a simpler writeback
before that DMA, while architectures that don't need to do the second
invalidate tend to have a combined writeback+invalidate before the
DMA.
arc is one of the architectures that does both, which seems unnecessary.
Change it to behave like arm/arm64/xtensa instead, and use just a
writeback before the DMA when we do the invalidate afterwards.
Signed-off-by: Arnd Bergmann <arnd at arndb.de>
---
arch/arc/mm/dma.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 2a7fbbb83b70..ddb96786f765 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -40,7 +40,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
* |----------------------------------------------------------------
* TO_DEV | writeback writeback | none none
* FROM_DEV | invalidate invalidate | invalidate* invalidate*
- * BIDIR | writeback+inv writeback+inv | invalidate invalidate
+ * BIDIR | writeback writeback | invalidate invalidate
*
* [*] needed for CPU speculative prefetches
*
@@ -61,7 +61,7 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
break;
case DMA_BIDIRECTIONAL:
- dma_cache_wback_inv(paddr, size);
+ dma_cache_wback(paddr, size);
break;
default:
--
2.39.2
More information about the linux-riscv
mailing list