Age | Commit message (Collapse) | Author |
|
This is a complete redesign and rewrite of libbmm. This implementation
is based upon dma_bufs - where a dma_buf is a kernel-side buffer which
can be passed to and from other subsystems. libbmm becomes a provider
of dma_bufs - it permits userspace to allocate such things.
When a dma_buf is allocated, userspace is handed a file descriptor
which is unique to this buffer. This file descriptor can then be
passed into other subsystems, which can then request access to this
buffer.
The file descriptor supports very few operations - it can be mmap()d to
provide userspace access to the buffer, and it can be closed when it is
no longer required. Internally in the kernel, dma_bufs are reference
counted, so the dma_buf will only be freed when the last user gives up
its reference.
|
|
Fix the "warning: function declaration isn't a prototype" warnings
in the bmm_lib code, printf formats in the test code, and make test
functions static.
|
|
libbmm calls into the kernel a lot to perform various functions such as
translating between virtual and physical addresses, finding out the
buffer size, and so forth. Much of this can be done in userspace,
because we have that information at the point where the buffer is
allocated.
Rather than having to keep fetching it from the kernel, store it in our
own local bmm_buffer structure, and store this in a pair of rb trees -
one indexed by physical address and the other by virtual address. This
allows us to efficiently look up the bmm_buffer structure by either
address, and retrieve the other buffer attribute(s).
Reference: http://web.eecs.utk.edu/~plank/plank/rbtree/rbtree.html
|
|
|
|
|
|
|