Linux DMA Mapping API: How Coherent and Streaming Mappings Differ
The Linux DMA mapping API helps driver authors translate CPU buffer addresses into bus addresses usable by devices, while also handling cache maintenance on non-coherent architectures. Two primary mapping types exist: coherent mappings for small, long-lived control structures that require no explicit syncing, and streaming mappings for bulk data transfers that must be explicitly synced if the CPU accesses the buffer mid-transfer. A key challenge is that DMA spans three distinct address spaces — kernel virtual, CPU physical, and device bus addresses — which are not interchangeable and cannot be used in place of one another. On non-coherent embedded SoCs, incorrect cache handling can cause data corruption that appears only on ARM targets but not on x86 systems, making bugs notoriously difficult to diagnose. The API abstracts these architecture-specific cache operations, and tools like CONFIG_DMA_API_DEBUG can help validate correct usage of map and unmap calls in driver code.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in