mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-13 04:38:20 +00:00
Add support for allocating DMA memory
This patch extends the RAM session interface with the ability to allocate DMA buffers. The client specifies the type of RAM dataspace to allocate via the new 'cached' argument of the 'Ram_session::alloc()' function. By default, 'cached' is true, which correponds to the common case and the original behavior. When setting 'cached' to 'false', core takes the precautions needed to register the memory as uncached in the page table of each process that has the dataspace attached. Currently, the support for allocating DMA buffers is implemented for Fiasco.OC only. On x86 platforms, it is generally not needed. But on platforms with more relaxed cache coherence (such as ARM), user-level device drivers should always use uncacheable memory for DMA transactions.
This commit is contained in:
@ -252,12 +252,12 @@ namespace Genode {
|
||||
Expanding_ram_session_client(Ram_session_capability cap)
|
||||
: Ram_session_client(cap), _cap(cap) { }
|
||||
|
||||
Ram_dataspace_capability alloc(size_t size) {
|
||||
Ram_dataspace_capability alloc(size_t size, bool cached) {
|
||||
bool try_again;
|
||||
do {
|
||||
try_again = false;
|
||||
try {
|
||||
return Ram_session_client::alloc(size);
|
||||
return Ram_session_client::alloc(size, cached);
|
||||
|
||||
} catch (Ram_session::Out_of_metadata) {
|
||||
|
||||
|
Reference in New Issue
Block a user