On 2/10/2016 3:15 PM, Bill Gray wrote:
> Charles,
> 
> Thanks so much for a definitive answer to this question!!!
> 
> Perhaps even more than the answer, I am fascinated by the account you give
> of how you know this to be the case!
> 
> I would like to have a better understanding of kernel drivers and DMA
> memory.  As an educational exercise I would like dig through the PRU kernel
> driver and see this code for myself?
> 
> Could you tell me where I can find it?

The uio_pruss kernel driver is part of the BeagleBone specific
patches, here's one place to find it in raw form if you don't have a
BBB specific kernel tree handy:

https://github.com/beagleboard/linux/blob/3.8/drivers/uio/uio_pruss.c#L267-L268

...as for DMA memory handling, that's complicated.  It is more complex
than generic memory handling in Linux (ie: kmalloc and friends), and
there isn't a whole lot of places it's properly talked about.  My day
job involves creating hardware that streams data across the PCI/PCIe
bus via bus-mastering DMA, so I'm familiar with all the details
involved, but to truly understand what's happening you need low-level
knowledge of the system architecture, memory model & access semantics,
physical bus transaction protocols, *PLUS* a bunch of Linux specific
details about how DMA is supposed to work.

I don't mean to be trying to discourage you, but there are *LOTS* of
low-level details that have to be done *JUST RIGHT* or you get weird
subtle bugs that only crop up every blue moon (see for example the
transition of Linux from single-core to SMP, or the poor state of
early ARM drivers that didn't properly handle ARMs relaxed memory
model vs. the x86).

Anyway, if you want to start to understand DMA on Linux, the best
single reference I know of is probably still "Memory Mapping and DMA",
or chapter 15 in LDD3:

https://lwn.net/Kernel/LDD3/

...at least until LDD4 comes out (I'm still waiting for my copy).

LDD3 is pretty dated (2005!), but the concepts are still pretty much
the same.  The interesting bits related to the uio_pruss driver usage
start with "DMA mappings" on page 445, with a discussion of coherent
buffers beginning on the next page.

Good luck!

-- 
Charles Steinkuehler
[email protected]

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to