@@ -341,7 +341,7 @@ static int __init process_chosen_node(const void *fdt, int node,
if ( rc )
return rc;
- bootinfo.static_heap = true;
+ static_heap = true;
}
printk("Checking for initrd in /chosen\n");
@@ -104,9 +104,15 @@ struct bootinfo {
#ifdef CONFIG_ACPI
struct meminfo acpi;
#endif
- bool static_heap;
};
+extern bool static_heap;
+#ifdef CONFIG_STATIC_MEMORY
+#define xen_is_using_staticheap() (static_heap)
+#else
+#define xen_is_using_staticheap() (false)
+#endif
+
struct map_range_data
{
struct domain *d;
@@ -246,7 +246,8 @@ static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
* Free the original kernel, update the pointers to the
* decompressed kernel
*/
- fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
+ if ( !xen_is_using_staticheap() )
+ fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
return 0;
}
@@ -177,8 +177,12 @@ void free_init_memory(void)
if ( rc )
panic("Unable to remove the init section (rc = %d)\n", rc);
- init_domheap_pages(pa, pa + len);
- printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
+ if ( !xen_is_using_staticheap() )
+ {
+ init_domheap_pages(pa, pa + len);
+ printk("Freed %ldkB init memory.\n",
+ (long)(__init_end-__init_begin)>>10);
+ }
}
void arch_dump_shared_mem_info(void)
@@ -196,7 +196,7 @@ void __init setup_mm(void)
total_pages = ram_size >> PAGE_SHIFT;
- if ( bootinfo.static_heap )
+ if ( xen_is_using_staticheap() )
{
for ( i = 0 ; i < bootinfo.reserved_mem.nr_banks; i++ )
{
@@ -241,7 +241,7 @@ void __init setup_mm(void)
do
{
- e = bootinfo.static_heap ?
+ e = xen_is_using_staticheap() ?
fit_xenheap_in_static_heap(pfn_to_paddr(xenheap_pages), MB(32)) :
consider_modules(ram_start, ram_end,
pfn_to_paddr(xenheap_pages),
@@ -59,6 +59,8 @@ bool __read_mostly acpi_disabled;
domid_t __read_mostly max_init_domid;
+bool __read_mostly static_heap;
+
static __used void init_done(void)
{
int rc;
@@ -508,22 +510,25 @@ void __init discard_initial_modules(void)
struct bootmodules *mi = &bootinfo.modules;
int i;
- for ( i = 0; i < mi->nr_mods; i++ )
+ if ( !xen_is_using_staticheap() )
{
- paddr_t s = mi->module[i].start;
- paddr_t e = s + PAGE_ALIGN(mi->module[i].size);
+ for ( i = 0; i < mi->nr_mods; i++ )
+ {
+ paddr_t s = mi->module[i].start;
+ paddr_t e = s + PAGE_ALIGN(mi->module[i].size);
- if ( mi->module[i].kind == BOOTMOD_XEN )
- continue;
+ if ( mi->module[i].kind == BOOTMOD_XEN )
+ continue;
- if ( !mfn_valid(maddr_to_mfn(s)) ||
- !mfn_valid(maddr_to_mfn(e)) )
- continue;
+ if ( !mfn_valid(maddr_to_mfn(s)) ||
+ !mfn_valid(maddr_to_mfn(e)) )
+ continue;
- fw_unreserved_regions(s, e, init_domheap_pages, 0);
- }
+ fw_unreserved_regions(s, e, init_domheap_pages, 0);
+ }
- mi->nr_mods = 0;
+ mi->nr_mods = 0;
+ }
remove_early_mappings();
}
@@ -660,7 +665,7 @@ void __init populate_boot_allocator(void)
const struct meminfo *banks = &bootinfo.mem;
paddr_t s, e;
- if ( bootinfo.static_heap )
+ if ( xen_is_using_staticheap() )
{
for ( i = 0 ; i < bootinfo.reserved_mem.nr_banks; i++ )
{