[LINUX] Extend physical mapping to maxmem instead of mem
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 10 Nov 2006 14:22:30 +0000 (14:22 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 10 Nov 2006 14:22:30 +0000 (14:22 +0000)
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 <gcosta@redhat.com>
linux-2.6-xen-sparse/arch/x86_64/kernel/e820-xen.c
linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h

index 333a9a26f47a37f787f9c3d5697e108f189c2b9d..a3dd2d98df43dbfa5e117c43515d7be32ec22bdb 100644 (file)
@@ -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;
index 7314dedbdeea0e5f5ef5424ad2788e3ec3a30f16..2ea18f44eb2bde6e63d5778906f878c5e36f65c7 100644 (file)
@@ -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;