From 033689ab90dc62b2dc349d37fa91708750a1ed93 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 16 Oct 2011 18:10:28 +0100 Subject: Do not map xen driver pages * xen/block.c (hyp_block_init): Use vm_page_grab_phys_addr instead of kmem_alloc_wired to allocate driver pages. * xen/net.c (hyp_net_init): Likewise. --- xen/block.c | 6 +++--- xen/net.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/block.c b/xen/block.c index 10befcc..02d410f 100644 --- a/xen/block.c +++ b/xen/block.c @@ -229,12 +229,12 @@ void hyp_block_init(void) { t = hyp_store_transaction_start(); /* Get a page for ring */ - if (kmem_alloc_wired(kernel_map, &addr, PAGE_SIZE) != KERN_SUCCESS) + if ((addr = vm_page_grab_phys_addr()) == -1) panic("%s: couldn't allocate space for store ring\n", device_name); - ring = (void*) addr; + ring = (void*) phystokv(addr); SHARED_RING_INIT(ring); FRONT_RING_INIT(&bd->ring, ring, PAGE_SIZE); - grant = hyp_grant_give(domid, atop(kvtophys(addr)), 0); + grant = hyp_grant_give(domid, atop(addr), 0); /* and give it to backend. */ i = sprintf(port_name, "%u", grant); diff --git a/xen/net.c b/xen/net.c index 5c1194c..2789828 100644 --- a/xen/net.c +++ b/xen/net.c @@ -283,12 +283,12 @@ void hyp_net_init(void) { t = hyp_store_transaction_start(); /* Get a page for tx_ring */ - if (kmem_alloc_wired(kernel_map, &addr, PAGE_SIZE) != KERN_SUCCESS) + if ((addr = vm_page_grab_phys_addr()) == -1) panic("eth: couldn't allocate space for store tx_ring"); - tx_ring = (void*) addr; + tx_ring = (void*) phystokv(addr); SHARED_RING_INIT(tx_ring); FRONT_RING_INIT(&nd->tx, tx_ring, PAGE_SIZE); - grant = hyp_grant_give(domid, atop(kvtophys(addr)), 0); + grant = hyp_grant_give(domid, atop(addr), 0); /* and give it to backend. */ i = sprintf(port_name, "%u", grant); @@ -298,12 +298,12 @@ void hyp_net_init(void) { kfree((vm_offset_t) c, strlen(c)+1); /* Get a page for rx_ring */ - if (kmem_alloc_wired(kernel_map, &addr, PAGE_SIZE) != KERN_SUCCESS) + if ((addr = vm_page_grab_phys_addr()) == -1) panic("eth: couldn't allocate space for store tx_ring"); - rx_ring = (void*) addr; + rx_ring = (void*) phystokv(addr); SHARED_RING_INIT(rx_ring); FRONT_RING_INIT(&nd->rx, rx_ring, PAGE_SIZE); - grant = hyp_grant_give(domid, atop(kvtophys(addr)), 0); + grant = hyp_grant_give(domid, atop(addr), 0); /* and give it to backend. */ i = sprintf(port_name, "%u", grant); @@ -396,12 +396,12 @@ void hyp_net_init(void) { /* Get a page for packet reception */ for (i= 0; irx_buf[i] = (void*)phystokv(kvtophys(addr)); - nd->rx_buf_pfn[i] = atop(kvtophys((vm_offset_t)nd->rx_buf[i])); + nd->rx_buf[i] = (void*)phystokv(addr); + nd->rx_buf_pfn[i] = atop(addr); if (!nd->rx_copy) { - if (hyp_do_update_va_mapping(kvtolin(addr), 0, UVMF_INVLPG|UVMF_ALL)) + if (hyp_do_update_va_mapping(kvtolin(nd->rx_buf[i]), 0, UVMF_INVLPG|UVMF_ALL)) panic("eth: couldn't clear rx kv buf %d at %p", i, addr); } /* and enqueue it to backend. */ -- cgit v1.2.3