arm64/dma-mapping: Fix arch_sync_dma_for_device to respect dir parameter

All other architectures do different cache operations depending on the
dir parameter. Fix arm64 to do the same.

This fixes udmabuf operations when syncing for read e.g. when the CPU
reads back a V4L2 decoded frame buffer.

Signed-off-by: John Cox <jc@kynesim.co.uk>
This commit is contained in:
John Cox
2025-08-12 12:33:36 +01:00
committed by Dom Cobley
parent 2857e60cd8
commit 60e9069014

View File

@@ -16,8 +16,22 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
enum dma_data_direction dir) enum dma_data_direction dir)
{ {
unsigned long start = (unsigned long)phys_to_virt(paddr); unsigned long start = (unsigned long)phys_to_virt(paddr);
unsigned long end = start + size;
dcache_clean_poc(start, start + size); switch (dir) {
case DMA_BIDIRECTIONAL:
dcache_clean_inval_poc(start, end);
break;
case DMA_TO_DEVICE:
dcache_clean_poc(start, end);
break;
case DMA_FROM_DEVICE:
dcache_inval_poc(start, end);
break;
case DMA_NONE:
default:
break;
}
} }
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,