How to find the memory regions of a process used for DMA
In linux kernel, given a process and its virtual memory space, is there a way to find the memory regions that are mapped for DMA (Direct Memory Access)? Maybe from the flags of its vma_area_struct?
Well, you could find out which pages are locked. But the fact that a page is locked does not necessarily imply that it is for DMA. If the DMA mappings are created by your driver, it is much easier to implement a proper book keeping instead of looking for DMA regions after-the-fact.