@@ -854,6 +854,10 @@ void dump_hyp_walk(vaddr_t addr)
void __init remove_early_mappings(void)
{
+ /* Earlier, early FDT is mapped with MAX_FDT_SIZE in early_fdt_map */
+ if ( destroy_xen_mappings(round_pgdown(dtb_paddr),
+ round_pgup(dtb_paddr + MAX_FDT_SIZE)) )
+ panic("Unable to destroy early Device-Tree mapping.\n");
}
int init_secondary_pagetables(int cpu)
@@ -412,31 +412,6 @@ const char * __init boot_module_kind_as_string(bootmodule_kind kind)
}
}
-void __init discard_initial_modules(void)
-{
- struct bootmodules *mi = &bootinfo.modules;
- int i;
-
- 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 ( !mfn_valid(maddr_to_mfn(s)) ||
- !mfn_valid(maddr_to_mfn(e)) )
- continue;
-
- fw_unreserved_regions(s, e, init_domheap_pages, 0);
- }
-
- mi->nr_mods = 0;
-
- remove_early_mappings();
-}
-
/* Relocate the FDT in Xen heap */
static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
{
@@ -340,6 +340,31 @@ void __init setup_mm(void)
}
#endif
+void __init discard_initial_modules(void)
+{
+ struct bootmodules *mi = &bootinfo.modules;
+ int i;
+
+ 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 ( !mfn_valid(maddr_to_mfn(s)) ||
+ !mfn_valid(maddr_to_mfn(e)) )
+ continue;
+
+ fw_unreserved_regions(s, e, init_domheap_pages, 0);
+ }
+
+ mi->nr_mods = 0;
+
+ remove_early_mappings();
+}
+
/*
* Local variables:
* mode: C
@@ -152,6 +152,32 @@ bool __init mpu_memory_section_contains(paddr_t s, paddr_t e,
return false;
}
+void __init discard_initial_modules(void)
+{
+ unsigned int i = 0;
+
+ /*
+ * Xenheap in MPU system must be statically configured in FDT in MPU
+ * system, so its base address and size couldn't change and it could not
+ * accept freed memory from boot modules.
+ * Disable MPU memory region of boot module section, since it will be in
+ * no use after boot.
+ */
+ for ( ; i < mpuinfo.sections[MSINFO_BOOTMODULE].nr_banks; i++ )
+ {
+ paddr_t start = mpuinfo.sections[MSINFO_BOOTMODULE].bank[i].start;
+ paddr_t size = mpuinfo.sections[MSINFO_BOOTMODULE].bank[i].size;
+ int rc;
+
+ rc = destroy_xen_mappings(start, start + size);
+ if ( rc )
+ panic("mpu: Unable to destroy boot module section 0x%"PRIpaddr"- 0x%"PRIpaddr"\n",
+ start, start + size);
+ }
+
+ remove_early_mappings();
+}
+
/*
* Local variables:
* mode: C