Skip to content

Commit d0d4af6

Browse files
jc-kynesimpelwell
authored andcommitted
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 <[email protected]>
1 parent b530ebd commit d0d4af6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

arch/arm64/mm/dma-mapping.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
1616
enum dma_data_direction dir)
1717
{
1818
unsigned long start = (unsigned long)phys_to_virt(paddr);
19+
unsigned long end = start + size;
1920

20-
dcache_clean_poc(start, start + size);
21+
switch (dir) {
22+
case DMA_BIDIRECTIONAL:
23+
dcache_clean_inval_poc(start, end);
24+
break;
25+
case DMA_TO_DEVICE:
26+
dcache_clean_poc(start, end);
27+
break;
28+
case DMA_FROM_DEVICE:
29+
dcache_inval_poc(start, end);
30+
break;
31+
case DMA_NONE:
32+
default:
33+
break;
34+
}
2135
}
2236

2337
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,

0 commit comments

Comments
 (0)