From: kaf24@firebug.cl.cam.ac.uk Date: Wed, 7 Jun 2006 10:24:44 +0000 (+0100) Subject: x86/64 Linux: destroy entire init memory mapping beyond kernel image. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15972^2~48 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2ad3e284b4cc608c2a5464e04fe95d8f11c6c922;p=xen.git x86/64 Linux: destroy entire init memory mapping beyond kernel image. Avoids overlap with modules mapping area. Signed-off-by: Jan Beulich --- diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c index e02aba7b34..0b88c1781f 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c @@ -819,14 +819,6 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_XEN { int i, j, k, fpp; - unsigned long va; - - /* 'Initial mapping' of initrd must be destroyed. */ - for (va = xen_start_info->mod_start; - va < (xen_start_info->mod_start+xen_start_info->mod_len); - va += PAGE_SIZE) { - HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0); - } if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* Make sure we have a large enough P->M table. */ @@ -842,14 +834,6 @@ void __init setup_arch(char **cmdline_p) PFN_PHYS(PFN_UP(xen_start_info->nr_pages * sizeof(unsigned long)))); - /* Destroyed 'initial mapping' of old p2m table. */ - for (va = xen_start_info->mfn_list; - va < (xen_start_info->mfn_list + - (xen_start_info->nr_pages*sizeof(unsigned long))); - va += PAGE_SIZE) { - HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0); - } - /* * Initialise the list of the frames that specify the * list of frames that make up the p2m table. Used by diff --git a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c index 3882686049..fe41bfacc3 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c @@ -668,12 +668,28 @@ void __meminit init_memory_mapping(unsigned long start, unsigned long end) if (!after_bootmem) { BUG_ON(start_pfn != table_end); - /* - * Destroy the temporary mappings created above. Prevents + + /* Re-vector virtual addresses pointing into the initial + mapping to the just-established permanent ones. */ + xen_start_info = __va(__pa(xen_start_info)); + xen_start_info->pt_base = (unsigned long) + __va(__pa(xen_start_info->pt_base)); + if (!xen_feature(XENFEAT_auto_translated_physmap)) { + phys_to_machine_mapping = + __va(__pa(xen_start_info->mfn_list)); + xen_start_info->mfn_list = (unsigned long) + phys_to_machine_mapping; + } + if (xen_start_info->mod_start) + xen_start_info->mod_start = (unsigned long) + __va(__pa(xen_start_info->mod_start)); + + /* Destroy the Xen-created mappings beyond the kernel image as + * well as the temporary mappings created above. Prevents * overlap with modules area (if init mapping is very big). */ - start = __START_KERNEL_map + (table_start << PAGE_SHIFT); - end = __START_KERNEL_map + (table_end << PAGE_SHIFT); + start = PAGE_ALIGN((unsigned long)_end); + end = __START_KERNEL_map + (table_end << PAGE_SHIFT); for (; start < end; start += PAGE_SIZE) WARN_ON(HYPERVISOR_update_va_mapping( start, __pte_ma(0), 0));