ia64/xen-unstable
changeset 13977:beab19d957de
linux: e820 handling adjustments
In certain places, machine_e820 should be used rather than e820.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
In certain places, machine_e820 should be used rather than e820.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author | kfraser@localhost.localdomain |
---|---|
date | Thu Feb 15 14:05:58 2007 +0000 (2007-02-15) |
parents | e253a63651bf |
children | 477a3bde3b61 |
files | linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/e820-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 Thu Feb 15 13:51:25 2007 +0000 1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Feb 15 14:05:58 2007 +0000 1.3 @@ -1034,8 +1034,16 @@ e820_all_mapped(unsigned long s, unsigne 1.4 u64 start = s; 1.5 u64 end = e; 1.6 int i; 1.7 + 1.8 +#ifndef CONFIG_XEN 1.9 for (i = 0; i < e820.nr_map; i++) { 1.10 struct e820entry *ei = &e820.map[i]; 1.11 +#else 1.12 + if (!is_initial_xendomain()) 1.13 + return 0; 1.14 + for (i = 0; i < machine_e820.nr_map; ++i) { 1.15 + const struct e820entry *ei = &machine_e820.map[i]; 1.16 +#endif 1.17 if (type && ei->type != type) 1.18 continue; 1.19 /* is the region (part) in overlap with the current region ?*/ 1.20 @@ -1505,9 +1513,6 @@ e820_setup_gap(struct e820entry *e820, i 1.21 */ 1.22 static int __init request_standard_resources(void) 1.23 { 1.24 -#ifdef CONFIG_XEN 1.25 - struct xen_memory_map memmap; 1.26 -#endif 1.27 int i; 1.28 1.29 /* Nothing to do if not running in dom0. */ 1.30 @@ -1516,13 +1521,6 @@ static int __init request_standard_resou 1.31 1.32 printk("Setting up standard PCI resources\n"); 1.33 #ifdef CONFIG_XEN 1.34 - memmap.nr_entries = E820MAX; 1.35 - set_xen_guest_handle(memmap.buffer, machine_e820.map); 1.36 - 1.37 - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) 1.38 - BUG(); 1.39 - machine_e820.nr_map = memmap.nr_entries; 1.40 - 1.41 legacy_init_iomem_resources(machine_e820.map, machine_e820.nr_map, 1.42 &code_resource, &data_resource); 1.43 #else 1.44 @@ -1546,12 +1544,22 @@ subsys_initcall(request_standard_resourc 1.45 1.46 static void __init register_memory(void) 1.47 { 1.48 +#ifdef CONFIG_XEN 1.49 + if (is_initial_xendomain()) { 1.50 + struct xen_memory_map memmap; 1.51 1.52 -#ifdef CONFIG_XEN 1.53 - e820_setup_gap(machine_e820.map, machine_e820.nr_map); 1.54 -#else 1.55 - e820_setup_gap(e820.map, e820.nr_map); 1.56 + memmap.nr_entries = E820MAX; 1.57 + set_xen_guest_handle(memmap.buffer, machine_e820.map); 1.58 + 1.59 + if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) 1.60 + BUG(); 1.61 + 1.62 + machine_e820.nr_map = memmap.nr_entries; 1.63 + e820_setup_gap(machine_e820.map, machine_e820.nr_map); 1.64 + } 1.65 + else 1.66 #endif 1.67 + e820_setup_gap(e820.map, e820.nr_map); 1.68 } 1.69 1.70 #ifdef CONFIG_MCA
2.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Thu Feb 15 13:51:25 2007 +0000 2.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c Thu Feb 15 14:05:58 2007 +0000 2.3 @@ -127,8 +127,19 @@ e820_any_mapped(unsigned long start, uns 2.4 int __init e820_all_mapped(unsigned long start, unsigned long end, unsigned type) 2.5 { 2.6 int i; 2.7 + 2.8 +#ifndef CONFIG_XEN 2.9 for (i = 0; i < e820.nr_map; i++) { 2.10 struct e820entry *ei = &e820.map[i]; 2.11 +#else 2.12 + extern struct e820map machine_e820; 2.13 + 2.14 + if (!is_initial_xendomain()) 2.15 + return 0; 2.16 + for (i = 0; i < machine_e820.nr_map; i++) { 2.17 + const struct e820entry *ei = &machine_e820.map[i]; 2.18 +#endif 2.19 + 2.20 if (type && ei->type != type) 2.21 continue; 2.22 /* is the region (part) in overlap with the current region ?*/
3.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu Feb 15 13:51:25 2007 +0000 3.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu Feb 15 14:05:58 2007 +0000 3.3 @@ -585,8 +585,6 @@ static void discover_ebda(void) 3.4 void __init setup_arch(char **cmdline_p) 3.5 { 3.6 #ifdef CONFIG_XEN 3.7 - struct xen_memory_map memmap; 3.8 - 3.9 /* Register a call for panic conditions. */ 3.10 atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); 3.11 3.12 @@ -895,6 +893,8 @@ void __init setup_arch(char **cmdline_p) 3.13 probe_roms(); 3.14 #ifdef CONFIG_XEN 3.15 if (is_initial_xendomain()) { 3.16 + struct xen_memory_map memmap; 3.17 + 3.18 memmap.nr_entries = E820MAX; 3.19 set_xen_guest_handle(memmap.buffer, machine_e820.map); 3.20