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

[Xen-changelog] [xen master] xen: arm: rework dom0 initrd and dtb placement



commit bef15de706d796f0d9f16fd3b69d6b5cada2ce9b
Author:     Ian Campbell <ian.campbell@xxxxxxxxxx>
AuthorDate: Wed Apr 9 12:51:16 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Apr 10 12:14:45 2014 +0100

    xen: arm: rework dom0 initrd and dtb placement
    
    This now uses the same decision tree as libxc (which is much easier to 
test).
    
    The main change is to explicitly handle the placement at 128MB or end of RAM
    as two cases, rather than combining with MIN. The effect is the same but the
    code is clearer.
    
    Secondly the attempt to place the modules right after the kernel is removed,
    since it is redundant with the case where placing them at the end of RAM 
ends
    up abutting the kernel.
    
    Also round the kernel size up to a 2MB boundary.
    
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
 xen/arch/arm/kernel.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index bc625a4..1102392 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -77,7 +77,7 @@ static void place_modules(struct kernel_info *info,
     const paddr_t rambase = info->mem.bank[0].start;
     const paddr_t ramsize = info->mem.bank[0].size;
     const paddr_t ramend = rambase + ramsize;
-    const paddr_t kernsize = kernend - kernbase;
+    const paddr_t kernsize = ROUNDUP(kernend, MB(2)) - kernbase;
     const paddr_t ram128mb = rambase + MB(128);
 
     paddr_t modbase;
@@ -95,16 +95,18 @@ static void place_modules(struct kernel_info *info,
      * If the bootloader provides an initrd, it will be loaded just
      * after the DTB.
      *
-     * We try to place dtb+initrd at 128MB, (or, if we have less RAM,
-     * as high as possible). If there is no space then fallback to
-     * just after the kernel, if there is room, otherwise just before.
+     * We try to place dtb+initrd at 128MB or if we have less RAM
+     * as high as possible. If there is no space then fallback to
+     * just before the kernel.
+     *
+     * If changing this then consider
+     * tools/libxc/xc_dom_arm.c:arch_setup_meminit as well.
      */
-
-    if ( kernend < MIN(ram128mb, ramend - modsize) )
-        modbase = MIN(ram128mb, ramend - modsize);
-    else if ( ramend - ROUNDUP(kernend, MB(2)) >= modsize )
-        modbase = ROUNDUP(kernend, MB(2));
-    else if ( kernbase - rambase >= modsize )
+    if ( ramend >= ram128mb + modsize && kernend < ram128mb )
+        modbase = ram128mb;
+    else if ( ramend - modsize > ROUNDUP(kernend, MB(2)) )
+        modbase = ramend - modsize;
+    else if ( kernbase - rambase > modsize )
         modbase = kernbase - modsize;
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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