Jan Beulich
2008-Apr-22 13:24 UTC
[Xen-devel] [PATCH] linux/x86: set up machine_e820 in copy_e820_map()
.. for it to be usable earlier (and also for being placed more logically). As usual, written and tested on 2.6.25 and made apply to the 2.6.18 tree without further testing. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: head-2008-04-02/arch/i386/kernel/setup-xen.c ==================================================================--- head-2008-04-02.orig/arch/i386/kernel/setup-xen.c 2008-03-05 15:22:37.000000000 +0100 +++ head-2008-04-02/arch/i386/kernel/setup-xen.c 2008-04-14 10:44:52.000000000 +0200 @@ -736,6 +736,21 @@ int __init copy_e820_map(struct e820entr #endif add_memory_region(start, size, type); } while (biosmap++,--nr_map); + +#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); + + if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) + BUG(); + machine_e820.nr_map = memmap.nr_entries; + } else + machine_e820 = e820; +#endif + return 0; } @@ -1569,18 +1584,8 @@ void __init e820_register_memory(void) static void __init register_memory(void) { #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); - - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) - BUG(); - - machine_e820.nr_map = memmap.nr_entries; + if (is_initial_xendomain()) e820_setup_gap(machine_e820.map, machine_e820.nr_map); - } else #endif e820_setup_gap(e820.map, e820.nr_map); Index: head-2008-04-02/arch/x86_64/kernel/e820-xen.c ==================================================================--- head-2008-04-02.orig/arch/x86_64/kernel/e820-xen.c 2008-04-02 15:00:51.000000000 +0200 +++ head-2008-04-02/arch/x86_64/kernel/e820-xen.c 2008-04-14 10:45:51.000000000 +0200 @@ -604,6 +604,21 @@ static int __init copy_e820_map(struct e add_memory_region(start, size, type); } while (biosmap++,--nr_map); + +#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); + + if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) + BUG(); + machine_e820.nr_map = memmap.nr_entries; + } else + machine_e820 = e820; +#endif + return 0; } Index: head-2008-04-02/arch/x86_64/kernel/setup-xen.c ==================================================================--- head-2008-04-02.orig/arch/x86_64/kernel/setup-xen.c 2008-04-08 14:33:27.000000000 +0200 +++ head-2008-04-02/arch/x86_64/kernel/setup-xen.c 2008-04-14 10:46:32.000000000 +0200 @@ -903,18 +903,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); - - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) - BUG(); - machine_e820.nr_map = memmap.nr_entries; - + if (is_initial_xendomain()) e820_reserve_resources(machine_e820.map, machine_e820.nr_map); - } #else e820_reserve_resources(e820.map, e820.nr_map); #endif _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel