diff options
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r-- | arch/x86/xen/setup.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index df118a825f39..46d6d21dbdbe 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -184,6 +184,19 @@ static unsigned long __init xen_set_identity(const struct e820entry *list, | |||
184 | PFN_UP(start_pci), PFN_DOWN(last)); | 184 | PFN_UP(start_pci), PFN_DOWN(last)); |
185 | return identity; | 185 | return identity; |
186 | } | 186 | } |
187 | |||
188 | static unsigned long __init xen_get_max_pages(void) | ||
189 | { | ||
190 | unsigned long max_pages = MAX_DOMAIN_PAGES; | ||
191 | domid_t domid = DOMID_SELF; | ||
192 | int ret; | ||
193 | |||
194 | ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid); | ||
195 | if (ret > 0) | ||
196 | max_pages = ret; | ||
197 | return min(max_pages, MAX_DOMAIN_PAGES); | ||
198 | } | ||
199 | |||
187 | /** | 200 | /** |
188 | * machine_specific_memory_setup - Hook for machine specific memory setup. | 201 | * machine_specific_memory_setup - Hook for machine specific memory setup. |
189 | **/ | 202 | **/ |
@@ -292,6 +305,14 @@ char * __init xen_memory_setup(void) | |||
292 | 305 | ||
293 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | 306 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); |
294 | 307 | ||
308 | extra_limit = xen_get_max_pages(); | ||
309 | if (max_pfn + extra_pages > extra_limit) { | ||
310 | if (extra_limit > max_pfn) | ||
311 | extra_pages = extra_limit - max_pfn; | ||
312 | else | ||
313 | extra_pages = 0; | ||
314 | } | ||
315 | |||
295 | extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); | 316 | extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820); |
296 | 317 | ||
297 | /* | 318 | /* |