[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 05/13] xen/arm: early_ioremap: allocate virtual addresses from top to bottom



Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/mm.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index ba3140d..bd7baaf 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -433,15 +433,17 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t 
pe)
  */
 void* __init early_ioremap(paddr_t start, size_t len, unsigned attributes)
 {
-    static unsigned long virt_start = EARLY_VMAP_VIRT_START;
-    unsigned long ret_addr = virt_start;
+    static unsigned long virt_start = EARLY_VMAP_VIRT_END;
     paddr_t end = start + len;
 
+    len = ((len + SECOND_SIZE - 1) >> SECOND_SHIFT) << SECOND_SHIFT;
+    virt_start -= len;
+
     ASSERT(!(start & (~SECOND_MASK)));
     ASSERT(!(virt_start & (~SECOND_MASK)));
 
     /* The range we need to map is too big */
-    if ( virt_start + len >= EARLY_VMAP_VIRT_END )
+    if ( virt_start >= EARLY_VMAP_VIRT_START )
         return NULL;
 
     while ( start < end )
@@ -453,9 +455,10 @@ void* __init early_ioremap(paddr_t start, size_t len, 
unsigned attributes)
         start += SECOND_SIZE;
         virt_start += SECOND_SIZE;
     }
-    flush_xen_data_tlb_range_va(ret_addr, len);
+    virt_start -= len;
+    flush_xen_data_tlb_range_va(virt_start, len);
 
-    return (void*)ret_addr;
+    return (void*)virt_start;
 }
 
 enum mg { mg_clear, mg_ro, mg_rw, mg_rx };
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.