xen/arm: do not relocate Xen outside of visible RAM
authorIan Campbell <ian.campbell@citrix.com>
Thu, 26 Sep 2013 11:35:37 +0000 (12:35 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 26 Sep 2013 15:21:33 +0000 (16:21 +0100)
Since we do not handle non-contiguous banks of memory lets avoid relocating
Xen into such a bank. Avoids issues such as free_init_memory releasing pages
which are outside of the frametable.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/arch/arm/setup.c

index b5c2b1779b05ef2332e6de379aec82f59075c552..82158978e296fd78b6e423e939f3abb716fa9d80 100644 (file)
@@ -240,17 +240,25 @@ static paddr_t __init get_xen_paddr(void)
 {
     struct dt_mem_info *mi = &early_info.mem;
     paddr_t min_size;
-    paddr_t paddr = 0;
+    paddr_t paddr = 0, last_end;
     int i;
 
     min_size = (_end - _start + (XEN_PADDR_ALIGN-1)) & ~(XEN_PADDR_ALIGN-1);
 
+    last_end = mi->bank[0].start;
+
     /* Find the highest bank with enough space. */
     for ( i = 0; i < mi->nr_banks; i++ )
     {
         const struct membank *bank = &mi->bank[i];
         paddr_t s, e;
 
+        /* We can only deal with contiguous memory at the moment */
+        if ( last_end != bank->start )
+            break;
+
+        last_end = bank->start + bank->size;
+
         if ( bank->size >= min_size )
         {
             e = consider_modules(bank->start, bank->start + bank->size,