base: introduce caching attributes (fix #1184)

On ARM it's relevant to not only distinguish between ordinary cached memory
and write-combined one, but also having non-cached memory too. To insert the
appropriated page table entries e.g.: in the base-hw kernel, we need to preserve
the information about the kind of memory from allocation until the pager
resolves a page fault. Therefore, this commit introduces a new Cache_attribute
type, and replaces the write_combined boolean with the new type where necessary.
This commit is contained in:
Stefan Kalkowski
2014-06-19 16:37:31 +02:00
committed by Norman Feske
parent 9580954d81
commit 786fe805da
60 changed files with 216 additions and 160 deletions

View File

@@ -0,0 +1,20 @@
/*
* \brief Generic cache declarations
* \author Stefan Kalkowski
* \date 2014-06-17
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__CACHE_H_
#define _INCLUDE__BASE__CACHE_H_
namespace Genode {
enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED };
}
#endif /* _INCLUDE__BASE__CACHE_H_ */

View File

@@ -25,7 +25,8 @@ namespace Genode {
explicit Ram_session_client(Ram_session_capability session)
: Rpc_client<Ram_session>(session) { }
Ram_dataspace_capability alloc(size_t size, bool cached = true) {
Ram_dataspace_capability alloc(size_t size,
Cache_attribute cached = CACHED) {
return call<Rpc_alloc>(size, cached); }
void free(Ram_dataspace_capability ds) { call<Rpc_free>(ds); }

View File

@@ -17,6 +17,7 @@
#include <base/stdint.h>
#include <base/capability.h>
#include <base/exception.h>
#include <base/cache.h>
#include <dataspace/capability.h>
#include <ram_session/capability.h>
#include <session/session.h>
@@ -49,7 +50,7 @@ namespace Genode {
* Allocate RAM dataspace
*
* \param size size of RAM dataspace
* \param cached true for cached memory, false for allocating
* \param cached selects cacheability attributes of the memory,
* uncached memory, i.e., for DMA buffers
*
* \throw Quota_exceeded
@@ -57,7 +58,7 @@ namespace Genode {
* \return capability to new RAM dataspace
*/
virtual Ram_dataspace_capability alloc(size_t size,
bool cached = true) = 0;
Cache_attribute cached = CACHED) = 0;
/**
* Free RAM dataspace
@@ -116,7 +117,7 @@ namespace Genode {
GENODE_RPC_THROW(Rpc_alloc, Ram_dataspace_capability, alloc,
GENODE_TYPE_LIST(Quota_exceeded, Out_of_metadata),
size_t, bool);
size_t, Cache_attribute);
GENODE_RPC(Rpc_free, void, free, Ram_dataspace_capability);
GENODE_RPC(Rpc_ref_account, int, ref_account, Ram_session_capability);
GENODE_RPC(Rpc_transfer_quota, int, transfer_quota, Ram_session_capability, size_t);