Eagerly map DMA buffers

This patch is a work-around for issue #452.
This commit is contained in:
Norman Feske 2012-11-26 09:36:57 +01:00
parent f2e47ef9f4
commit 0bcf55800f

View File

@ -22,6 +22,7 @@
#define _INCLUDE__OS__ATTACHED_RAM_DATASPACE_H_
#include <ram_session/ram_session.h>
#include <util/touch.h>
#include <base/env.h>
namespace Genode {
@ -61,6 +62,23 @@ namespace Genode {
_ram_session->free(_ds);
throw;
}
/*
* Eagerly map dataspace if used for DMA
*
* On some platforms, namely Fiasco.OC on ARMv7, the handling
* of page faults interferes with the caching attributes used
* for uncached DMA memory. See issue #452 for more details
* (https://github.com/genodelabs/genode/issues/452). As a
* work-around for this issues, we eagerly map the whole
* dataspace before writing actual content to it.
*/
if (!_cached) {
enum { PAGE_SIZE = 4096 };
unsigned char volatile *base = (unsigned char volatile *)_local_addr;
for (size_t i = 0; i < _size; i += PAGE_SIZE)
touch_read_write(base + i);
}
}
public: