Where to start learning Linux DMA drivers / devices / memory allocation

I am porting / debugging a device driver (which is used by another kernel module) and is facing a dead end because dma_sync_single_for_device () fails with the kernel.

I donโ€™t know what this function should do, and googling really doesnโ€™t help, so I probably need to learn more about this material in general.

The question is where to start?

Oh, yes, in case it matters, the code should work on PowerPC (and linux - OpenWRT)

EDIT: Online resources are preferable (books take several days: 1)

+6
memory-management linux embedded dma
source share
3 answers

Online:

Slab Linux Distributor Anatomy

Linux Virtual Memory Manager Overview

Linux Device Drivers Third Edition

Linux Kernel Module Programming Guide

Writing Device Drivers on Linux: A Quick Guide

Books:

Linux Kernel Development (2nd Edition)

Basic Linux device drivers (Only the first 4-5 chapters)

Useful resources:

Linux reference (source kernel for all kernels)

API changes in the 2.6 kernel series


dma_sync_single_for_device calls dma_sync_single_range_for_cpu little further in the file, and this is the original documentation (I assume that even if this is for the hand, the interface and behavior are the same):

 /** 380 * dma_sync_single_range_for_cpu 381 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 382 * @handle: DMA address of buffer 383 * @offset: offset of region to start sync 384 * @size: size of region to sync 385 * @dir: DMA transfer direction (same as passed to dma_map_single) 386 * 387 * Make physical memory consistent for a single streaming mode DMA 388 * translation after a transfer. 389 * 390 * If you perform a dma_map_single() but wish to interrogate the 391 * buffer using the cpu, yet do not wish to teardown the PCI dma 392 * mapping, you must call this function before doing so. At the 393 * next point you give the PCI dma address back to the card, you 394 * must first the perform a dma_sync_for_device, and then the 395 * device again owns the buffer. 396 */ 
+9
source share
+5
source share

Chapters Linux device drivers (in the same series as the Linux kernel recommended by @Matthew Flaschen) can be useful.

You can download indiivudal sections from the LWN Website . Chapter 16 deals with DMA.

+3
source share

All Articles