xen: arm: don't release modules which aren't in RAM into the heap
authorIan Campbell <ian.campbell@citrix.com>
Wed, 23 Jul 2014 16:45:30 +0000 (17:45 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 24 Jul 2014 15:23:18 +0000 (16:23 +0100)
They might be in e.g. flash or something but more likely they could
be in a bank of RAM which we aren't handling or in RAM which the
bootloader hasn't told us about for some reason.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Cc: Fu Wei <fu.wei@linaro.org>
Cc: Roy Franz <roy.franz@linaro.org>
xen/arch/arm/setup.c

index e53e491f8b18c9cdc463c3586bdb96ff37e5e587..446b4dc007ea97fbcc38056ed2915f9a4dda212e 100644 (file)
@@ -247,8 +247,13 @@ void __init discard_initial_modules(void)
         paddr_t s = mi->module[i].start;
         paddr_t e = s + PAGE_ALIGN(mi->module[i].size);
 
-        if ( mi->module[i].kind != BOOTMOD_XEN )
-            dt_unreserved_regions(s, e, init_domheap_pages, 0);
+        if ( mi->module[i].kind == BOOTMOD_XEN )
+            continue;
+
+        if ( !mfn_valid(paddr_to_pfn(s)) || !mfn_valid(paddr_to_pfn(e)))
+            continue;
+
+        dt_unreserved_regions(s, e, init_domheap_pages, 0);
     }
 
     mi->nr_mods = 0;