ia64/xen-unstable

changeset 10325:ec903b8e6612

x86/64 Linux: destroy entire init memory mapping beyond kernel image.
Avoids overlap with modules mapping area.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 07 11:24:44 2006 +0100 (2006-06-07)
parents 9d86c1a70f34
children 28128dafbe03
files linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Wed Jun 07 11:03:51 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Wed Jun 07 11:24:44 2006 +0100
     1.3 @@ -819,14 +819,6 @@ void __init setup_arch(char **cmdline_p)
     1.4  #ifdef CONFIG_XEN
     1.5  	{
     1.6  		int i, j, k, fpp;
     1.7 -		unsigned long va;
     1.8 -
     1.9 -		/* 'Initial mapping' of initrd must be destroyed. */
    1.10 -		for (va = xen_start_info->mod_start;
    1.11 -		     va < (xen_start_info->mod_start+xen_start_info->mod_len);
    1.12 -		     va += PAGE_SIZE) {
    1.13 -			HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
    1.14 -		}
    1.15  
    1.16  		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
    1.17  			/* Make sure we have a large enough P->M table. */
    1.18 @@ -842,14 +834,6 @@ void __init setup_arch(char **cmdline_p)
    1.19  				PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
    1.20  						sizeof(unsigned long))));
    1.21  
    1.22 -			/* Destroyed 'initial mapping' of old p2m table. */
    1.23 -			for (va = xen_start_info->mfn_list;
    1.24 -			     va < (xen_start_info->mfn_list +
    1.25 -				   (xen_start_info->nr_pages*sizeof(unsigned long)));
    1.26 -			     va += PAGE_SIZE) {
    1.27 -				HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
    1.28 -			}
    1.29 -
    1.30  			/*
    1.31  			 * Initialise the list of the frames that specify the
    1.32  			 * list of frames that make up the p2m table. Used by
     2.1 --- a/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c	Wed Jun 07 11:03:51 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/mm/init-xen.c	Wed Jun 07 11:24:44 2006 +0100
     2.3 @@ -668,12 +668,28 @@ void __meminit init_memory_mapping(unsig
     2.4  
     2.5  	if (!after_bootmem) {
     2.6  		BUG_ON(start_pfn != table_end);
     2.7 -		/*
     2.8 -		 * Destroy the temporary mappings created above. Prevents
     2.9 +
    2.10 +		/* Re-vector virtual addresses pointing into the initial
    2.11 +		   mapping to the just-established permanent ones. */
    2.12 +		xen_start_info = __va(__pa(xen_start_info));
    2.13 +		xen_start_info->pt_base = (unsigned long)
    2.14 +			__va(__pa(xen_start_info->pt_base));
    2.15 +		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
    2.16 +			phys_to_machine_mapping =
    2.17 +				__va(__pa(xen_start_info->mfn_list));
    2.18 +			xen_start_info->mfn_list = (unsigned long)
    2.19 +				phys_to_machine_mapping;
    2.20 +		}
    2.21 +		if (xen_start_info->mod_start)
    2.22 +			xen_start_info->mod_start = (unsigned long)
    2.23 +				__va(__pa(xen_start_info->mod_start));
    2.24 +
    2.25 +		/* Destroy the Xen-created mappings beyond the kernel image as
    2.26 +		 * well as the temporary mappings created above. Prevents
    2.27  		 * overlap with modules area (if init mapping is very big).
    2.28  		 */
    2.29 -		start = __START_KERNEL_map + (table_start << PAGE_SHIFT);
    2.30 -		end   = __START_KERNEL_map + (table_end   << PAGE_SHIFT);
    2.31 +		start = PAGE_ALIGN((unsigned long)_end);
    2.32 +		end   = __START_KERNEL_map + (table_end << PAGE_SHIFT);
    2.33  		for (; start < end; start += PAGE_SIZE)
    2.34  			WARN_ON(HYPERVISOR_update_va_mapping(
    2.35  				start, __pte_ma(0), 0));