Reserving memory for DMA usage

Viewed 1945

I am trying to make use of a contiguous memory i reserved while passing the "mem" parameter to Linux when booting.

Now, i have the physical address of this space i reserved earlier, and the length of it, and i wish to make use of this reserved space for DMA purposes in my driver.

Normally i would use dma_alloc_coherent() , and if i were using CMA i would use that too, but in this case, its different.

Now, i have read that an acceptable way of mapping a physical space to kernel virtual space is to use ioremap

And, an acceptable way of "taking over" a contiguous space for DMA purposes is to use dma_map_single (mapping it for bus address)

I'm having trouble combining the two. ioremap works and returns a virtual address. Now, i have read that this is no ordinary virtual address and i should only be using access methods to read/write from this memory.

Thing is, when i try to pass this virtual address to dma_map_single , it doesn't report an error, but i suspect that this is wrong.

Am i doing it right? What can i do to make it work like it should?

10x

1 Answers
Related