From 6de27d5b5e5ba94d573905d799a75dd3da12ff03 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 10 Nov 2006 14:22:30 +0000 Subject: [PATCH] [LINUX] Extend physical mapping to maxmem instead of mem As currently physical mapping only reaches the initial reservation, we're unable to balloon up to more than mem (even when maxmem > mem) in any situation. Signed-off-by: Glauber de Oliveira Costa --- linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c | 9 +++++++-- .../include/asm-i386/mach-xen/setup_arch_post.h | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c index 333a9a26f4..a3dd2d98df 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c @@ -583,15 +583,20 @@ void __init setup_memory_region(void) * the boot process we know we have plenty slack space. */ struct e820entry map[E820MAX]; + unsigned long arg = DOMID_SELF; memmap.nr_entries = E820MAX; set_xen_guest_handle(memmap.buffer, map); rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); - if ( rc == -ENOSYS ) { + if (rc == -ENOSYS) { memmap.nr_entries = 1; map[0].addr = 0ULL; - map[0].size = xen_start_info->nr_pages << PAGE_SHIFT; + rc = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &arg); + if (rc < 0) + map[0].size = xen_start_info->nr_pages << PAGE_SHIFT; + else + map[0].size = rc << PAGE_SHIFT; /* 8MB slack (to balance backend allocations). */ map[0].size += 8 << 20; map[0].type = E820_RAM; diff --git a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h index 7314dedbde..2ea18f44eb 100644 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h @@ -13,6 +13,7 @@ static char * __init machine_specific_memory_setup(void) { int rc; struct xen_memory_map memmap; + unsigned long arg = DOMID_SELF; /* * This is rather large for a stack variable but this early in * the boot process we know we have plenty slack space. @@ -23,9 +24,14 @@ static char * __init machine_specific_memory_setup(void) set_xen_guest_handle(memmap.buffer, map); rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap); - if ( rc == -ENOSYS ) { + if (rc == -ENOSYS) { memmap.nr_entries = 1; map[0].addr = 0ULL; + rc = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &arg); + if (rc < 0) + map[0].size = PFN_PHYS(xen_start_info->nr_pages); + else + map[0].size = PFN_PHYS(rc); map[0].size = PFN_PHYS(xen_start_info->nr_pages); /* 8MB slack (to balance backend allocations). */ map[0].size += 8ULL << 20; -- 2.30.2