linux-mips
[Top] [All Lists]

[PATCH 1/2] MIPS: Allow for initrd outside of the reserved memory range.

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 1/2] MIPS: Allow for initrd outside of the reserved memory range.
From: David Daney <ddaney@caviumnetworks.com>
Date: Thu, 13 Jan 2011 17:55:42 -0800
Cc: David Daney <ddaney@caviumnetworks.com>
In-reply-to: <1294970143-16124-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1294970143-16124-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
Introduce a flag, initrd_not_reserved, that when set will disable the
logic of moving the reserved_end to the end of the initrd.

This allows the initrd to be placed anywhere in memory and have its
memory reclaimed if it is placed in a BOOT_MEM_INIT_RAM region.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 arch/mips/include/asm/bootinfo.h |    1 +
 arch/mips/kernel/setup.c         |   12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 7a51d87..0a4fd82 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -102,6 +102,7 @@ struct boot_mem_map {
 };
 
 extern struct boot_mem_map boot_mem_map;
+extern int initrd_not_reserved;
 
 extern void add_memory_region(phys_t start, phys_t size, long type);
 
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 2d4eb68..8e65480 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -59,6 +59,9 @@ EXPORT_SYMBOL(mips_machtype);
 
 struct boot_mem_map boot_mem_map;
 
+/* Set if the initrd memory is BOOT_MEM_INIT_RAM */
+int initrd_not_reserved;
+
 static char __initdata command_line[COMMAND_LINE_SIZE];
 char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
 
@@ -267,8 +270,13 @@ static void __init bootmem_init(void)
         * not selected. Once that done we can determine the low bound
         * of usable memory.
         */
-       reserved_end = max(init_initrd(),
-                          (unsigned long) PFN_UP(__pa_symbol(&_end)));
+       if (initrd_not_reserved) {
+               init_initrd();
+               reserved_end = PFN_UP(__pa_symbol(&_end));
+       } else {
+               reserved_end = max(init_initrd(),
+                                  (unsigned long) PFN_UP(__pa_symbol(&_end)));
+       }
 
        /*
         * max_low_pfn is not a number of pages. The number of pages
-- 
1.7.2.3


<Prev in Thread] Current Thread [Next in Thread>