Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: use flush_kernel_dcache_area() for dmabounce

After copying data from the bounce buffer to the real buffer, use
flush_kernel_dcache_page() to ensure that data is written back in
manner coherent with future userspace mappings.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+4 -8
+4 -8
arch/arm/common/dmabounce.c
··· 308 308 memcpy(ptr, buf->safe, size); 309 309 310 310 /* 311 - * DMA buffers must have the same cache properties 312 - * as if they were really used for DMA - which means 313 - * data must be written back to RAM. Note that 314 - * we don't use dmac_flush_range() here for the 315 - * bidirectional case because we know the cache 316 - * lines will be coherent with the data written. 311 + * Since we may have written to a page cache page, 312 + * we need to ensure that the data will be coherent 313 + * with user mappings. 317 314 */ 318 - dmac_clean_range(ptr, ptr + size); 319 - outer_clean_range(__pa(ptr), __pa(ptr) + size); 315 + __cpuc_flush_kernel_dcache_area(ptr, size); 320 316 } 321 317 free_safe_buffer(dev->archdata.dmabounce, buf); 322 318 }