ia64/xen-unstable

changeset 11552:1adaf06e8abc

[LINUX] Provide permanent global version of machine_e820 map for
general use.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Sep 21 09:37:03 2006 +0100 (2006-09-21)
parents affbab70fca2
children e50872355390
files linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Wed Sep 20 18:41:44 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Thu Sep 21 09:37:03 2006 +0100
     1.3 @@ -156,6 +156,9 @@ struct ist_info ist_info;
     1.4  EXPORT_SYMBOL(ist_info);
     1.5  #endif
     1.6  struct e820map e820;
     1.7 +#ifdef CONFIG_XEN
     1.8 +struct e820map machine_e820;
     1.9 +#endif
    1.10  
    1.11  extern void early_cpu_init(void);
    1.12  extern void generic_apic_probe(char *);
    1.13 @@ -1451,7 +1454,6 @@ e820_setup_gap(struct e820entry *e820, i
    1.14  static void __init register_memory(void)
    1.15  {
    1.16  #ifdef CONFIG_XEN
    1.17 -	struct e820entry *machine_e820;
    1.18  	struct xen_memory_map memmap;
    1.19  #endif
    1.20  	int	      i;
    1.21 @@ -1461,14 +1463,14 @@ static void __init register_memory(void)
    1.22  		return;
    1.23  
    1.24  #ifdef CONFIG_XEN
    1.25 -	machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
    1.26 +	memmap.nr_entries = E820MAX;
    1.27 +	set_xen_guest_handle(memmap.buffer, machine_e820.map);
    1.28  
    1.29 -	memmap.nr_entries = E820MAX;
    1.30 -	set_xen_guest_handle(memmap.buffer, machine_e820);
    1.31 +	if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    1.32 +		BUG();
    1.33 +	machine_e820.nr_map = memmap.nr_entries;
    1.34  
    1.35 -	BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
    1.36 -
    1.37 -	legacy_init_iomem_resources(machine_e820, memmap.nr_entries,
    1.38 +	legacy_init_iomem_resources(machine_e820.map, machine_e820.nr_map,
    1.39  				    &code_resource, &data_resource);
    1.40  #else
    1.41  	if (efi_enabled)
    1.42 @@ -1486,8 +1488,7 @@ static void __init register_memory(void)
    1.43  		request_resource(&ioport_resource, &standard_io_resources[i]);
    1.44  
    1.45  #ifdef CONFIG_XEN
    1.46 -	e820_setup_gap(machine_e820, memmap.nr_entries);
    1.47 -	free_bootmem(__pa(machine_e820), PAGE_SIZE);
    1.48 +	e820_setup_gap(machine_e820.map, machine_e820.nr_map);
    1.49  #else
    1.50  	e820_setup_gap(e820.map, e820.nr_map);
    1.51  #endif
     2.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Wed Sep 20 18:41:44 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Thu Sep 21 09:37:03 2006 +0100
     2.3 @@ -144,6 +144,9 @@ struct sys_desc_table_struct {
     2.4  
     2.5  struct edid_info edid_info;
     2.6  struct e820map e820;
     2.7 +#ifdef CONFIG_XEN
     2.8 +struct e820map machine_e820;
     2.9 +#endif
    2.10  
    2.11  extern int root_mountflags;
    2.12  
    2.13 @@ -626,7 +629,6 @@ static void __init reserve_ebda_region(v
    2.14  void __init setup_arch(char **cmdline_p)
    2.15  {
    2.16  	unsigned long kernel_end;
    2.17 -	struct e820entry *machine_e820;
    2.18  	struct xen_memory_map memmap;
    2.19  
    2.20  #ifdef CONFIG_XEN
    2.21 @@ -919,14 +921,14 @@ void __init setup_arch(char **cmdline_p)
    2.22  	probe_roms();
    2.23  #ifdef CONFIG_XEN
    2.24  	if (is_initial_xendomain()) {
    2.25 -		machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
    2.26 +		memmap.nr_entries = E820MAX;
    2.27 +		set_xen_guest_handle(memmap.buffer, machine_e820.map);
    2.28  
    2.29 -		memmap.nr_entries = E820MAX;
    2.30 -		set_xen_guest_handle(memmap.buffer, machine_e820);
    2.31 +		if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
    2.32 +			BUG();
    2.33 +		machine_e820.nr_map = memmap.nr_entries;
    2.34  
    2.35 -		BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
    2.36 -
    2.37 -		e820_reserve_resources(machine_e820, memmap.nr_entries);
    2.38 +		e820_reserve_resources(machine_e820.map, machine_e820.nr_map);
    2.39  	}
    2.40  #else
    2.41  	e820_reserve_resources(e820.map, e820.nr_map);
    2.42 @@ -942,10 +944,8 @@ void __init setup_arch(char **cmdline_p)
    2.43  	}
    2.44  
    2.45  #ifdef CONFIG_XEN
    2.46 -	if (is_initial_xendomain()) {
    2.47 -		e820_setup_gap(machine_e820, memmap.nr_entries);
    2.48 -		free_bootmem(__pa(machine_e820), PAGE_SIZE);
    2.49 -	}
    2.50 +	if (is_initial_xendomain())
    2.51 +		e820_setup_gap(machine_e820.map, machine_e820.nr_map);
    2.52  #else
    2.53  	e820_setup_gap(e820.map, e820.nr_map);
    2.54  #endif