Skip to contentSkip to conversation

xen/arm: Dummy implementation of multi-bank support

PATCH In review Julien Grall 2 participants 2 messages Jul 15, 2013 – Jul 17, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Dummy implementation of multi-bank support

U-boot for the arndale board splits the memory in 8 contiguous banks and rewrites the memory node. So most of the memory is lost.

As the frametable is only able to handle contiguous memory, use the first contiguous banks and warn if some of the memory banks are not used.

---
 xen/arch/arm/setup.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
xen/arch/arm/setup.c +17 -6
index b192d15..ead51b8 100644
@@ -288,16 +288,27 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)
     unsigned long heap_pages, xenheap_pages, domheap_pages;
     unsigned long dtb_pages;
     unsigned long boot_mfn_start, boot_mfn_end;
+    int i = 0;
 
-    /*
-     * TODO: only using the first RAM bank for now.  The heaps and the
-     * frame table assume RAM is physically contiguous.
-     */
-    if ( early_info.mem.nr_banks > 1 )
-        early_printk("WARNING: Only using first bank of memory\n");
+    /* TODO: Handle non-contiguous memory bank */
+    if ( !early_info.mem.nr_banks )
+        early_panic("No memory bank\n");
     ram_start = early_info.mem.bank[0].start;
     ram_size  = early_info.mem.bank[0].size;
     ram_end = ram_start + ram_size;
+
+    for ( i = 1; i < early_info.mem.nr_banks; i++ )
+    {
+        if ( ram_end != early_info.mem.bank[i].start )
+            break;
+
+        ram_size += early_info.mem.bank[i].size;
+        ram_end += early_info.mem.bank[i].size;
+    }
+
+    if ( i != early_info.mem.nr_banks )
+        early_printk("WARNING: some banks are not used\n");
+
     total_pages = ram_pages = ram_size >> PAGE_SHIFT;
 
     /*
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Julien Grall

U-boot for the arndale board splits the memory in 8 contiguous banks and rewrites the memory node. So most of the memory is lost.

As the frametable is only able to handle contiguous memory, use the first contiguous banks and warn if some of the memory banks are not used.

xen/arch/arm/setup.c static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) · line 310

Quoted 2 lines
xen/arch/arm/setup.c +2 -0
+    if ( i != early_info.mem.nr_banks )
+        early_printk("WARNING: some banks are not used\n");

I made this "some memory banks...."

Quoted 4 lines

+

     total_pages = ram_pages = ram_size >> PAGE_SHIFT;
 
     /*