aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2011-09-28 12:46:34 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-09-29 11:12:10 -0400
commit8b5d44a5ac93cd7a1b044db3ff0ba4955b4ba5ec (patch)
tree3db094063c6ae765704414a0d84bc8a009c4c2d6 /arch/x86/xen
parentb1cbf9b1d6af22ba262d99abcfd71d5d90dbd57a (diff)
xen: allow balloon driver to use more than one memory region
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). Signed-off-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r--arch/x86/xen/setup.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index c983717c018c..0c8e974c738a 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -37,7 +37,7 @@ extern void xen_syscall_target(void);
37extern void xen_syscall32_target(void); 37extern void xen_syscall32_target(void);
38 38
39/* Amount of extra memory space we add to the e820 ranges */ 39/* Amount of extra memory space we add to the e820 ranges */
40phys_addr_t xen_extra_mem_start, xen_extra_mem_size; 40struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
41 41
42/* Number of pages released from the initial allocation. */ 42/* Number of pages released from the initial allocation. */
43unsigned long xen_released_pages; 43unsigned long xen_released_pages;
@@ -59,7 +59,7 @@ static void __init xen_add_extra_mem(unsigned long pages)
59 unsigned long pfn; 59 unsigned long pfn;
60 60
61 u64 size = (u64)pages * PAGE_SIZE; 61 u64 size = (u64)pages * PAGE_SIZE;
62 u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; 62 u64 extra_start = xen_extra_mem[0].start + xen_extra_mem[0].size;
63 63
64 if (!pages) 64 if (!pages)
65 return; 65 return;
@@ -69,7 +69,7 @@ static void __init xen_add_extra_mem(unsigned long pages)
69 69
70 memblock_x86_reserve_range(extra_start, extra_start + size, "XEN EXTRA"); 70 memblock_x86_reserve_range(extra_start, extra_start + size, "XEN EXTRA");
71 71
72 xen_extra_mem_size += size; 72 xen_extra_mem[0].size += size;
73 73
74 xen_max_p2m_pfn = PFN_DOWN(extra_start + size); 74 xen_max_p2m_pfn = PFN_DOWN(extra_start + size);
75 75
@@ -242,7 +242,7 @@ char * __init xen_memory_setup(void)
242 242
243 memcpy(map_raw, map, sizeof(map)); 243 memcpy(map_raw, map, sizeof(map));
244 e820.nr_map = 0; 244 e820.nr_map = 0;
245 xen_extra_mem_start = mem_end; 245 xen_extra_mem[0].start = mem_end;
246 for (i = 0; i < memmap.nr_entries; i++) { 246 for (i = 0; i < memmap.nr_entries; i++) {
247 unsigned long long end; 247 unsigned long long end;
248 248
@@ -270,8 +270,8 @@ char * __init xen_memory_setup(void)
270 e820_add_region(end, delta, E820_UNUSABLE); 270 e820_add_region(end, delta, E820_UNUSABLE);
271 } 271 }
272 272
273 if (map[i].size > 0 && end > xen_extra_mem_start) 273 if (map[i].size > 0 && end > xen_extra_mem[0].start)
274 xen_extra_mem_start = end; 274 xen_extra_mem[0].start = end;
275 275
276 /* Add region if any remains */ 276 /* Add region if any remains */
277 if (map[i].size > 0) 277 if (map[i].size > 0)
@@ -279,10 +279,10 @@ char * __init xen_memory_setup(void)
279 } 279 }
280 /* Align the balloon area so that max_low_pfn does not get set 280 /* Align the balloon area so that max_low_pfn does not get set
281 * to be at the _end_ of the PCI gap at the far end (fee01000). 281 * to be at the _end_ of the PCI gap at the far end (fee01000).
282 * Note that xen_extra_mem_start gets set in the loop above to be 282 * Note that the start of balloon area gets set in the loop above
283 * past the last E820 region. */ 283 * to be past the last E820 region. */
284 if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32))) 284 if (xen_initial_domain() && (xen_extra_mem[0].start < (1ULL<<32)))
285 xen_extra_mem_start = (1ULL<<32); 285 xen_extra_mem[0].start = (1ULL<<32);
286 286
287 /* 287 /*
288 * In domU, the ISA region is normal, usable memory, but we 288 * In domU, the ISA region is normal, usable memory, but we