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

[Xen-changelog] [xen-unstable] [LINUX] Set up /proc/iomem in a sensibel way to indicate



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID fe35ddc5fd380f8c1cbc41b6f8df49874051effd
# Parent  6fb0d5ad63d74ef272d1f1754b9eabd83000577e
[LINUX] Set up /proc/iomem in a sensibel way to indicate
code & data resources, and a RAM area on domU.
From: Gerd Hoffmann <kraxel@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c   |   21 ++++++++++++--------
 linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c  |    6 -----
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c |    9 ++++++--
 3 files changed, 21 insertions(+), 15 deletions(-)

diff -r 6fb0d5ad63d7 -r fe35ddc5fd38 
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Jun 08 10:11:04 
2006 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu Jun 08 10:24:48 
2006 +0100
@@ -1378,7 +1378,6 @@ legacy_init_iomem_resources(struct e820e
                res->end = res->start + e820[i].size - 1;
                res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
                request_resource(&iomem_resource, res);
-#ifndef CONFIG_XEN
                if (e820[i].type == E820_RAM) {
                        /*
                         *  We don't know which RAM region contains kernel data,
@@ -1391,7 +1390,6 @@ legacy_init_iomem_resources(struct e820e
                        request_resource(res, &crashk_res);
 #endif
                }
-#endif
        }
 }
 
@@ -1460,8 +1458,16 @@ static void __init register_memory(void)
        int           i;
 
        /* Nothing to do if not running in dom0. */
-       if (!(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
+               struct e820entry domU_e820 = {
+                       .addr = 0,
+                       .size = max_pfn << PAGE_SHIFT,
+                       .type = E820_RAM,
+               };
+               legacy_init_iomem_resources(&domU_e820, 1,
+                                           &code_resource, &data_resource);
                return;
+       }
 
 #ifdef CONFIG_XEN
        machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
@@ -1698,11 +1704,10 @@ void __init setup_arch(char **cmdline_p)
        init_mm.brk = (PFN_UP(__pa(xen_start_info->pt_base)) +
                       xen_start_info->nr_pt_frames) << PAGE_SHIFT;
 
-       /* XEN: This is nonsense: kernel may not even be contiguous in RAM. */
-       /*code_resource.start = virt_to_phys(_text);*/
-       /*code_resource.end = virt_to_phys(_etext)-1;*/
-       /*data_resource.start = virt_to_phys(_etext);*/
-       /*data_resource.end = virt_to_phys(_edata)-1;*/
+       code_resource.start = virt_to_phys(_text);
+       code_resource.end = virt_to_phys(_etext)-1;
+       data_resource.start = virt_to_phys(_etext);
+       data_resource.end = virt_to_phys(_edata)-1;
 
        parse_cmdline_early(cmdline_p);
 
diff -r 6fb0d5ad63d7 -r fe35ddc5fd38 
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 Jun 08 
10:11:04 2006 +0100
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c        Thu Jun 08 
10:24:48 2006 +0100
@@ -44,9 +44,7 @@ unsigned long end_pfn_map;
  */
 unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT;  
 
-#ifndef CONFIG_XEN
 extern struct resource code_resource, data_resource;
-#endif
 
 /* Check for some hardcoded bad areas that early boot is not allowed to touch 
*/ 
 static inline int bad_addr(unsigned long *addrp, unsigned long size)
@@ -251,8 +249,7 @@ void __init e820_reserve_resources(struc
                res->end = res->start + e820[i].size - 1;
                res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
                request_resource(&iomem_resource, res);
-#ifndef CONFIG_XEN
-               if (e820.map[i].type == E820_RAM) {
+               if (e820[i].type == E820_RAM) {
                        /*
                         *  We don't know which RAM region contains kernel data,
                         *  so we try it repeatedly and let the resource manager
@@ -264,7 +261,6 @@ void __init e820_reserve_resources(struc
                        request_resource(res, &crashk_res);
 #endif
                }
-#endif
        }
 }
 
diff -r 6fb0d5ad63d7 -r fe35ddc5fd38 
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 Jun 08 
10:11:04 2006 +0100
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Jun 08 
10:24:48 2006 +0100
@@ -692,12 +692,10 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data = (unsigned long) &_edata;
        init_mm.brk = (unsigned long) &_end;
 
-#ifndef CONFIG_XEN
        code_resource.start = virt_to_phys(&_text);
        code_resource.end = virt_to_phys(&_etext)-1;
        data_resource.start = virt_to_phys(&_etext);
        data_resource.end = virt_to_phys(&_edata)-1;
-#endif
 
        parse_cmdline_early(cmdline_p);
 
@@ -921,6 +919,13 @@ void __init setup_arch(char **cmdline_p)
                BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, 
&memmap));
 
                e820_reserve_resources(machine_e820, memmap.nr_entries);
+       } else {
+               struct e820entry domU_e820 = {
+                       .addr = 0,
+                       .size = max_pfn << PAGE_SHIFT,
+                       .type = E820_RAM,
+               };
+               e820_reserve_resources(&domU_e820, 1);
        }
 #elif !defined(CONFIG_XEN)
        probe_roms();

_______________________________________________
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®.