[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] linux: e820 handling adjustments



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1171548358 0
# Node ID beab19d957de8677bd6093c317c93e71cc143411
# Parent  e253a63651bf9b08045dfb50a5c54f0e0311b8db
linux: e820 handling adjustments
In certain places, machine_e820 should be used rather than e820.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c   |   38 ++++++++++++--------
 linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c  |   11 +++++
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c |    4 +-
 3 files changed, 36 insertions(+), 17 deletions(-)

diff -r e253a63651bf -r beab19d957de 
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Feb 15 13:51:25 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Feb 15 14:05:58 
2007 +0000
@@ -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
@@ -1546,12 +1544,22 @@ subsys_initcall(request_standard_resourc
 
 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);
-#endif
+       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;
+               e820_setup_gap(machine_e820.map, machine_e820.nr_map);
+       }
+       else
+#endif
+               e820_setup_gap(e820.map, e820.nr_map);
 }
 
 #ifdef CONFIG_MCA
diff -r e253a63651bf -r beab19d957de 
linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c        Thu Feb 15 
13:51:25 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c        Thu Feb 15 
14:05:58 2007 +0000
@@ -127,8 +127,19 @@ int __init e820_all_mapped(unsigned long
 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 ?*/
diff -r e253a63651bf -r beab19d957de 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Feb 15 
13:51:25 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Feb 15 
14:05:58 2007 +0000
@@ -585,8 +585,6 @@ void __init setup_arch(char **cmdline_p)
 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.