]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen: allow balloon driver to use more than one memory region
authorDavid Vrabel <david.vrabel@citrix.com>
Wed, 28 Sep 2011 16:46:34 +0000 (17:46 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 11 May 2012 18:04:47 +0000 (14:04 -0400)
Allow the xen balloon driver to populate its list of extra pages from
more than one region of memory.  This will allow platforms to provide
(for example) a region of low memory and a region of high memory.

The maximum possible number of extra regions is 128 (== E820MAX) which
is quite large so xen_extra_mem is placed in __initdata.  This is safe
as both xen_memory_setup() and balloon_init() are in __init.

The balloon regions themselves are not altered (i.e., there is still
only the one region).

[upstream git commit 8b5d44a]
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Conflicts:

drivers/xen/balloon.c
[The "Add support for pv hugepages and support for huge balloon pages." has
a lot of these fixes in]

arch/x86/xen/setup.c
include/xen/page.h

index 09688eb4a899b8bd64e28b4dd4142e851dbc70bb..43efed38fbd328ae71a8c7565a97b58b42eee270 100644 (file)
@@ -36,7 +36,7 @@ extern void xen_syscall_target(void);
 extern void xen_syscall32_target(void);
 
 /* Amount of extra memory space we add to the e820 ranges */
-phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
+struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
 
 /* 
  * The maximum amount of extra memory compared to the base size.  The
@@ -55,7 +55,7 @@ static void __init xen_add_extra_mem(unsigned long pages)
        unsigned long pfn;
 
        u64 size = (u64)pages * PAGE_SIZE;
-       u64 extra_start = xen_extra_mem_start + xen_extra_mem_size;
+       u64 extra_start = xen_extra_mem[0].start + xen_extra_mem[0].size;
 
        if (!pages)
                return;
@@ -65,7 +65,7 @@ static void __init xen_add_extra_mem(unsigned long pages)
 
        memblock_x86_reserve_range(extra_start, extra_start + size, "XEN EXTRA");
 
-       xen_extra_mem_size += size;
+       xen_extra_mem[0].size += size;
 
        xen_max_p2m_pfn = PFN_DOWN(extra_start + size);
 
@@ -238,7 +238,7 @@ char * __init xen_memory_setup(void)
 
        memcpy(map_raw, map, sizeof(map));
        e820.nr_map = 0;
-       xen_extra_mem_start = mem_end;
+       xen_extra_mem[0].start = mem_end;
        for (i = 0; i < memmap.nr_entries; i++) {
                unsigned long long end;
 
@@ -266,8 +266,8 @@ char * __init xen_memory_setup(void)
                                e820_add_region(end, delta, E820_UNUSABLE);
                }
 
-               if (map[i].size > 0 && end > xen_extra_mem_start)
-                       xen_extra_mem_start = end;
+               if (map[i].size > 0 && end > xen_extra_mem[0].start)
+                       xen_extra_mem[0].start = end;
 
                /* Add region if any remains */
                if (map[i].size > 0)
@@ -275,10 +275,10 @@ char * __init xen_memory_setup(void)
        }
        /* Align the balloon area so that max_low_pfn does not get set
         * to be at the _end_ of the PCI gap at the far end (fee01000).
-        * Note that xen_extra_mem_start gets set in the loop above to be
-        * past the last E820 region. */
-       if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
-               xen_extra_mem_start = (1ULL<<32);
+        * Note that the start of balloon area gets set in the loop above
+        * to be past the last E820 region. */
+       if (xen_initial_domain() && (xen_extra_mem[0].start < (1ULL<<32)))
+               xen_extra_mem[0].start = (1ULL<<32);
 
        /*
         * In domU, the ISA region is normal, usable memory, but we
index 0be36b976f4b02905034532919e7fc576eba19d7..2ba101cc72244afd338299d25e6985c25294a7eb 100644 (file)
@@ -3,6 +3,14 @@
 
 #include <asm/xen/page.h>
 
-extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
+struct xen_memory_region {
+       phys_addr_t start;
+       phys_addr_t size;
+};
+
+#define XEN_EXTRA_MEM_MAX_REGIONS 128 /* == E820MAX */
+
+extern __initdata
+struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS];
 
 #endif /* _XEN_PAGE_H */