nova: support write combining

Fixes #1566
This commit is contained in:
Alexander Boettcher 2015-08-25 11:46:32 +02:00 committed by Christian Helmuth
parent e304bd926e
commit 0f2c2a675a
7 changed files with 24 additions and 16 deletions

View File

@ -540,7 +540,8 @@ namespace Nova {
bool kern_pd = false,
bool update_guest_pt = false,
bool translate_map = false,
bool dma_mem = false)
bool dma_mem = false,
bool write_combined = false)
{
/* transfer items start at the end of the UTCB */
items += 1 << 16;
@ -556,16 +557,19 @@ namespace Nova {
/* map from hypervisor or current pd */
unsigned h = kern_pd ? (1 << 11) : 0;
/* map write-combined */
unsigned wc = write_combined ? (1 << 10) : 0;
/* update guest page table */
unsigned g = update_guest_pt ? (1 << 10) : 0;
unsigned g = update_guest_pt ? (1 << 9) : 0;
/* mark memory dma able */
unsigned d = dma_mem ? (1 << 9) : 0;
unsigned d = dma_mem ? (1 << 8) : 0;
/* set type of delegation, either 'map' or 'translate and map' */
unsigned m = translate_map ? 2 : 1;
item->hotspot = crd.hotspot(sel_hotspot) | g | h | d | m;
item->hotspot = crd.hotspot(sel_hotspot) | g | h | wc | d | m;
item->crd = crd.value();
return true;

View File

@ -1 +1 @@
361b07cc4c3e43610e1bb772932597d45be69c28
61ea642d86312acd24698976f79d4530132c05a2

View File

@ -4,7 +4,7 @@ DOWNLOADS := nova.git
# r9 branch
URL(nova) := https://github.com/alex-ab/NOVA.git
REV(nova) := 834519fa28b1f2fc46e3b10746b4838a19470c7a
REV(nova) := a4a926a749ecdce5ae04d16465aa1872bc626755
DIR(nova) := src/kernel/nova
PATCHES := $(wildcard $(REP_DIR)/patches/*.patch)

View File

@ -44,12 +44,13 @@ static void echo_reply()
Nova::mword_t offset = echo()->utcb()->msg[1];
bool kern_pd = echo()->utcb()->msg[2];
bool dma_mem = echo()->utcb()->msg[3];
bool write_combined = echo()->utcb()->msg[4];
/* reset message transfer descriptor */
echo()->utcb()->set_msg_word(0);
/* append capability-range as message-transfer item */
bool res = echo()->utcb()->append_item(snd_rcv, offset, kern_pd, false,
false, dma_mem);
false, dma_mem, write_combined);
/* set return code, 0 means failure */
echo()->utcb()->msg[0] = res;

View File

@ -32,7 +32,7 @@ namespace Genode {
addr_t _dst_addr;
addr_t _core_local_addr;
bool _write_combined;
Cache_attribute _attr;
size_t _size_log2;
bool _rw;
@ -49,8 +49,7 @@ namespace Genode {
bool rw = true)
:
_dst_addr(dst_addr), _core_local_addr(map_addr),
_write_combined(c != CACHED), _size_log2(size_log2),
_rw(rw)
_attr(c), _size_log2(size_log2), _rw(rw)
{ }
/**
@ -67,7 +66,8 @@ namespace Genode {
Nova::Rights(true, _rw, true));
}
bool write_combined() { return _write_combined; };
bool dma() { return _attr != CACHED; };
bool write_combined() { return _attr == WRITE_COMBINED; };
addr_t dst_addr() { return _dst_addr; }
};

View File

@ -64,7 +64,8 @@ inline Genode::addr_t boot_cpu()
* from the echo EC to the calling EC.
*/
static int map_local(Nova::Utcb *utcb, Nova::Crd src_crd, Nova::Crd dst_crd,
bool kern_pd = false, bool dma_mem = false)
bool kern_pd = false, bool dma_mem = false,
bool write_combined = false)
{
/* open receive window at current EC */
utcb->crd_rcv = dst_crd;
@ -74,7 +75,8 @@ static int map_local(Nova::Utcb *utcb, Nova::Crd src_crd, Nova::Crd dst_crd,
utcb->msg[1] = 0;
utcb->msg[2] = kern_pd;
utcb->msg[3] = dma_mem;
utcb->set_msg_word(4);
utcb->msg[4] = write_combined;
utcb->set_msg_word(5);
/* establish the mapping via a portal traversal during reply phase */
Nova::uint8_t res = Nova::call(echo()->pt_sel());
@ -131,7 +133,8 @@ inline int map_local(Nova::Utcb *utcb,
Genode::addr_t from_start, Genode::addr_t to_start,
Genode::size_t num_pages,
Nova::Rights const &permission,
bool kern_pd = false, bool dma_mem = false)
bool kern_pd = false, bool dma_mem = false,
bool write_combined = false)
{
if (verbose_local_map)
Genode::printf("::map_local: from %lx to %lx, %zd pages from kernel %u\n",
@ -173,7 +176,7 @@ inline int map_local(Nova::Utcb *utcb,
int const res = map_local(utcb,
Mem_crd((from_curr >> 12), order - get_page_size_log2(), permission),
Mem_crd((to_curr >> 12), order - get_page_size_log2(), permission),
kern_pd, dma_mem);
kern_pd, dma_mem, write_combined);
if (res) return res;
/* advance offset by current flexpage size */

View File

@ -61,7 +61,7 @@ void Ipc_pager::set_reply_mapping(Mapping m)
Nova::Utcb *utcb = (Nova::Utcb *)Thread_base::myself()->utcb();
utcb->set_msg_word(0);
bool res = utcb->append_item(m.mem_crd(), m.dst_addr(), false, false,
false, m.write_combined());
false, m.dma(), m.write_combined());
/* one item ever fits on the UTCB */
(void)res;
}