Jan Beulich
2007-Feb-14 15:57 UTC
[Xen-devel] [PATCH 2/8] 2.6.17: E820 handling adjustments
In certain places, machine_e820 should be used rather than e820. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: head-2007-02-08/arch/i386/kernel/setup-xen.c ==================================================================--- head-2007-02-08.orig/arch/i386/kernel/setup-xen.c 2007-02-08 17:07:13.000000000 +0100 +++ head-2007-02-08/arch/i386/kernel/setup-xen.c 2007-02-08 17:09:47.000000000 +0100 @@ -1034,8 +1034,16 @@ e820_all_mapped(unsigned long s, unsigne u64 start = s; u64 end = e; int i; + +#ifndef CONFIG_XEN for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; +#else + if (!is_initial_xendomain()) + return 0; + for (i = 0; i < machine_e820.nr_map; ++i) { + const struct e820entry *ei = &machine_e820.map[i]; +#endif if (type && ei->type != type) continue; /* is the region (part) in overlap with the current region ?*/ @@ -1505,9 +1513,6 @@ e820_setup_gap(struct e820entry *e820, i */ static int __init request_standard_resources(void) { -#ifdef CONFIG_XEN - struct xen_memory_map memmap; -#endif int i; /* Nothing to do if not running in dom0. */ @@ -1516,13 +1521,6 @@ static int __init request_standard_resou printk("Setting up standard PCI resources\n"); #ifdef CONFIG_XEN - memmap.nr_entries = E820MAX; - set_xen_guest_handle(memmap.buffer, machine_e820.map); - - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) - BUG(); - machine_e820.nr_map = memmap.nr_entries; - legacy_init_iomem_resources(machine_e820.map, machine_e820.nr_map, &code_resource, &data_resource); #else @@ -1548,10 +1546,20 @@ static void __init register_memory(void) { #ifdef CONFIG_XEN - e820_setup_gap(machine_e820.map, machine_e820.nr_map); -#else - e820_setup_gap(e820.map, e820.nr_map); + if (is_initial_xendomain()) { + struct xen_memory_map memmap; + + memmap.nr_entries = E820MAX; + set_xen_guest_handle(memmap.buffer, machine_e820.map); + + BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)); + + machine_e820.nr_map = memmap.nr_entries; + e820_setup_gap(machine_e820.map, machine_e820.nr_map); + } + else #endif + e820_setup_gap(e820.map, e820.nr_map); } #ifdef CONFIG_MCA Index: head-2007-02-08/arch/x86_64/kernel/e820-xen.c ==================================================================--- head-2007-02-08.orig/arch/x86_64/kernel/e820-xen.c 2007-02-08 17:07:13.000000000 +0100 +++ head-2007-02-08/arch/x86_64/kernel/e820-xen.c 2007-02-08 17:09:47.000000000 +0100 @@ -127,8 +127,19 @@ e820_any_mapped(unsigned long start, uns int __init e820_all_mapped(unsigned long start, unsigned long end, unsigned type) { int i; + +#ifndef CONFIG_XEN for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; +#else + extern struct e820map machine_e820; + + if (!is_initial_xendomain()) + return 0; + for (i = 0; i < machine_e820.nr_map; i++) { + const struct e820entry *ei = &machine_e820.map[i]; +#endif + if (type && ei->type != type) continue; /* is the region (part) in overlap with the current region ?*/ Index: head-2007-02-08/arch/x86_64/kernel/setup-xen.c ==================================================================--- head-2007-02-08.orig/arch/x86_64/kernel/setup-xen.c 2007-02-08 17:07:13.000000000 +0100 +++ head-2007-02-08/arch/x86_64/kernel/setup-xen.c 2007-02-08 17:09:47.000000000 +0100 @@ -585,8 +585,6 @@ static void discover_ebda(void) void __init setup_arch(char **cmdline_p) { #ifdef CONFIG_XEN - struct xen_memory_map memmap; - /* Register a call for panic conditions. */ atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); @@ -895,6 +893,8 @@ void __init setup_arch(char **cmdline_p) probe_roms(); #ifdef CONFIG_XEN if (is_initial_xendomain()) { + struct xen_memory_map memmap; + memmap.nr_entries = E820MAX; set_xen_guest_handle(memmap.buffer, machine_e820.map); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel