ia64/linux-2.6.18-xen.hg

changeset 526:f128849f9e78

linux/x86: set up machine_e820 in copy_e820_map() for it to be usable
earlier (and also for being placed more logically).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 22 14:41:51 2008 +0100 (2008-04-22)
parents 7f8b544237bf
children 81c5a517a42b
files arch/i386/kernel/setup-xen.c arch/x86_64/kernel/e820-xen.c arch/x86_64/kernel/setup-xen.c
line diff
     1.1 --- a/arch/i386/kernel/setup-xen.c	Tue Apr 15 15:18:58 2008 +0100
     1.2 +++ b/arch/i386/kernel/setup-xen.c	Tue Apr 22 14:41:51 2008 +0100
     1.3 @@ -736,6 +736,21 @@ int __init copy_e820_map(struct e820entr
     1.4  #endif
     1.5  		add_memory_region(start, size, type);
     1.6  	} while (biosmap++,--nr_map);
     1.7 +
     1.8 +#ifdef CONFIG_XEN
     1.9 +	if (is_initial_xendomain()) {
    1.10 +		struct xen_memory_map memmap;
    1.11 +
    1.12 +		memmap.nr_entries = E820MAX;
    1.13 +		set_xen_guest_handle(memmap.buffer, machine_e820.map);
    1.14 +
    1.15 +		if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    1.16 +			BUG();
    1.17 +		machine_e820.nr_map = memmap.nr_entries;
    1.18 +	} else
    1.19 +		machine_e820 = e820;
    1.20 +#endif
    1.21 +
    1.22  	return 0;
    1.23  }
    1.24  
    1.25 @@ -1569,18 +1584,8 @@ subsys_initcall(request_standard_resourc
    1.26  static void __init register_memory(void)
    1.27  {
    1.28  #ifdef CONFIG_XEN
    1.29 -	if (is_initial_xendomain()) {
    1.30 -		struct xen_memory_map memmap;
    1.31 -
    1.32 -		memmap.nr_entries = E820MAX;
    1.33 -		set_xen_guest_handle(memmap.buffer, machine_e820.map);
    1.34 -
    1.35 -		if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    1.36 -			BUG();
    1.37 -
    1.38 -		machine_e820.nr_map = memmap.nr_entries;
    1.39 +	if (is_initial_xendomain())
    1.40  		e820_setup_gap(machine_e820.map, machine_e820.nr_map);
    1.41 -	}
    1.42  	else
    1.43  #endif
    1.44  		e820_setup_gap(e820.map, e820.nr_map);
     2.1 --- a/arch/x86_64/kernel/e820-xen.c	Tue Apr 15 15:18:58 2008 +0100
     2.2 +++ b/arch/x86_64/kernel/e820-xen.c	Tue Apr 22 14:41:51 2008 +0100
     2.3 @@ -604,6 +604,21 @@ static int __init copy_e820_map(struct e
     2.4  
     2.5  		add_memory_region(start, size, type);
     2.6  	} while (biosmap++,--nr_map);
     2.7 +
     2.8 +#ifdef CONFIG_XEN
     2.9 +	if (is_initial_xendomain()) {
    2.10 +		struct xen_memory_map memmap;
    2.11 +
    2.12 +		memmap.nr_entries = E820MAX;
    2.13 +		set_xen_guest_handle(memmap.buffer, machine_e820.map);
    2.14 +
    2.15 +		if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    2.16 +			BUG();
    2.17 +		machine_e820.nr_map = memmap.nr_entries;
    2.18 +	} else
    2.19 +		machine_e820 = e820;
    2.20 +#endif
    2.21 +
    2.22  	return 0;
    2.23  }
    2.24  
     3.1 --- a/arch/x86_64/kernel/setup-xen.c	Tue Apr 15 15:18:58 2008 +0100
     3.2 +++ b/arch/x86_64/kernel/setup-xen.c	Tue Apr 22 14:41:51 2008 +0100
     3.3 @@ -903,18 +903,8 @@ void __init setup_arch(char **cmdline_p)
     3.4  	 */
     3.5  	probe_roms();
     3.6  #ifdef CONFIG_XEN
     3.7 -	if (is_initial_xendomain()) {
     3.8 -		struct xen_memory_map memmap;
     3.9 -
    3.10 -		memmap.nr_entries = E820MAX;
    3.11 -		set_xen_guest_handle(memmap.buffer, machine_e820.map);
    3.12 -
    3.13 -		if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    3.14 -			BUG();
    3.15 -		machine_e820.nr_map = memmap.nr_entries;
    3.16 -
    3.17 +	if (is_initial_xendomain())
    3.18  		e820_reserve_resources(machine_e820.map, machine_e820.nr_map);
    3.19 -	}
    3.20  #else
    3.21  	e820_reserve_resources(e820.map, e820.nr_map);
    3.22  #endif