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

[Xen-changelog] [xen master] xen/arm: Reserve FDT via early module mechanism



commit c883eed77ae2bec5aca2f678bfd7fe4642fa6d37
Author:     Ian Campbell <ian.campbell@xxxxxxxxxx>
AuthorDate: Thu Sep 26 12:35:36 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Sep 26 16:21:27 2013 +0100

    xen/arm: Reserve FDT via early module mechanism
    
    This will stop us putting any heaps or relocating Xen itself over the FDT.
    
    The devicetree will be copied to allocated memory in setup_mm and the
    original copy will be freed by discard_initial_modules.
    
    Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/arm/setup.c          |    3 ++-
 xen/common/device_tree.c      |    9 ++++++++-
 xen/include/xen/device_tree.h |   13 +++++++------
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 24bbc73..b5c2b17 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -622,9 +622,10 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     smp_clear_cpu_maps();
 
+    /* This is mapped by head.S */
     device_tree_flattened = (void *)BOOT_MISC_VIRT_START
         + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
-    fdt_size = device_tree_early_init(device_tree_flattened);
+    fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
 
     cmdline_parse(device_tree_bootargs(device_tree_flattened));
 
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 9a16650..793e9a8 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -420,14 +420,21 @@ static void __init early_print_info(void)
  *
  * Returns the size of the DTB.
  */
-size_t __init device_tree_early_init(const void *fdt)
+size_t __init device_tree_early_init(const void *fdt, paddr_t paddr)
 {
+    struct dt_mb_module *mod;
     int ret;
 
     ret = fdt_check_header(fdt);
     if ( ret < 0 )
         early_panic("No valid device tree\n");
 
+    mod = &early_info.modules.module[MOD_FDT];
+    mod->start = paddr;
+    mod->size = fdt_totalsize(fdt);
+
+    early_info.modules.nr_mods = max(MOD_FDT, early_info.modules.nr_mods);
+
     device_tree_for_each_node((void *)fdt, early_scan_node, NULL);
     early_print_info();
 
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 7810f53..a665c97 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -20,12 +20,13 @@
 
 #define NR_MEM_BANKS 8
 
-#define MOD_XEN 0
-#define MOD_KERNEL 1
-#define MOD_INITRD 2
-#define NR_MODULES 3
+#define MOD_XEN    0
+#define MOD_FDT    1
+#define MOD_KERNEL 2
+#define MOD_INITRD 3
+#define NR_MODULES 4
 
-#define MOD_DISCARD_FIRST MOD_KERNEL
+#define MOD_DISCARD_FIRST MOD_FDT
 
 struct membank {
     paddr_t start;
@@ -179,7 +180,7 @@ typedef int (*device_tree_node_func)(const void *fdt,
 extern struct dt_early_info early_info;
 extern const void *device_tree_flattened;
 
-size_t __init device_tree_early_init(const void *fdt);
+size_t __init device_tree_early_init(const void *fdt, paddr_t paddr);
 
 const char __init *device_tree_bootargs(const void *fdt);
 void __init device_tree_dump(const void *fdt);
--
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®.