In Documentation/DMA-mapping.txt:

If you acquired your memory via the page allocator
(i.e. __get_free_page*()) or the generic memory allocators
(i.e. kmalloc() or kmem_cache_alloc()) then you may DMA to/from
that memory using the addresses returned from those routines.

This means specifically that you may _not_ use the memory/addresses
returned from vmalloc() for DMA.  It is possible to DMA to the
_underlying_ memory mapped into a vmalloc() area, but this requires
walking page tables to get the physical addresses, and then
translating each of those pages back to a kernel address using
something like __va().

My Question:

1.   when any generic hardware (non-CPU) attempts to write to the memory,
they will access it via the physical address - right?

2.   when the CPU attempt to access the memory, they can access it via the
virtual address + MMU + pagetable mechanism to retrieve the data - right?

3..   I don't understand this part - "this requires walking page tables to
get the physical addresses, and then translating each of those pages back to
a kernel address using something like __va(). ".

what is the difference between get_free_page()/kmem_cache_alloc() and
vmalloc() that makes the former dma-able, and latter not?

Reply via email to