From: David Gibson <david@gibson.dropbear.id.au>
To: <linuxppc-dev@ozlabs.org>
Subject: [PATCH 2/15] Automatically lmb_reserve() initrd
Date: Mon, 5 Mar 2007 14:24:50 +1100 (EST) [thread overview]
Message-ID: <20070305032450.44F57DDF1B@ozlabs.org> (raw)
In-Reply-To: <20070305032307.GB31417@localhost.localdomain>
At present, when an initrd is passed to the kernel used flat device
tree properties, the memory the initrd occupies must also be reserved
in the flat tree's reserve map, or the kernel may overwrite it. That
makes life more complicated than it could be for the bootwrapper.
This patch makes the kernel automatically reserve the initrd's space.
That in turn requires parsing the initrd parameters earlier than they
are currently, in early_init_dt_scan_chosen() instead of
check_for_initrd().
Signed-off-by: David Gibson <dwg@au1.ibm.com>
---
arch/powerpc/kernel/prom.c | 23 +++++++++++++++++++++++
arch/powerpc/kernel/setup-common.c | 22 ++--------------------
2 files changed, 25 insertions(+), 20 deletions(-)
Index: working-2.6/arch/powerpc/kernel/prom.c
===================================================================
--- working-2.6.orig/arch/powerpc/kernel/prom.c 2007-02-09 15:12:00.000000000 +1100
+++ working-2.6/arch/powerpc/kernel/prom.c 2007-02-09 15:14:27.000000000 +1100
@@ -719,6 +719,7 @@ static int __init early_init_dt_scan_cho
const char *uname, int depth, void *data)
{
unsigned long *lprop;
+ u32 *prop;
unsigned long l;
char *p;
@@ -760,6 +761,22 @@ static int __init early_init_dt_scan_cho
crashk_res.end = crashk_res.start + *lprop - 1;
#endif
+#ifdef CONFIG_BLK_DEV_INITRD
+ DBG("Looking for initrd properties... ");
+ prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
+ if (prop) {
+ initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
+ prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
+ if (prop) {
+ initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
+ initrd_below_start_ok = 1;
+ } else {
+ initrd_start = 0;
+ }
+ }
+ DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
+#endif /* CONFIG_BLK_DEV_INITRD */
+
/* Retreive command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
@@ -926,6 +943,12 @@ static void __init early_reserve_mem(voi
self_size = initial_boot_params->totalsize;
lmb_reserve(self_base, self_size);
+#ifdef CONFIG_BLK_DEV_INITRD
+ /* then reserve the initrd, if any */
+ if (initrd_start && (initrd_end > initrd_start))
+ lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
+#endif /* CONFIG_BLK_DEV_INITRD */
+
#ifdef CONFIG_PPC32
/*
* Handle the case where we might be booting from an old kexec
Index: working-2.6/arch/powerpc/kernel/setup-common.c
===================================================================
--- working-2.6.orig/arch/powerpc/kernel/setup-common.c 2007-01-24 12:01:17.000000000 +1100
+++ working-2.6/arch/powerpc/kernel/setup-common.c 2007-02-09 15:15:15.000000000 +1100
@@ -304,26 +304,8 @@ struct seq_operations cpuinfo_op = {
void __init check_for_initrd(void)
{
#ifdef CONFIG_BLK_DEV_INITRD
- const unsigned int *prop;
- int len;
-
- DBG(" -> check_for_initrd()\n");
-
- if (of_chosen) {
- prop = get_property(of_chosen, "linux,initrd-start", &len);
- if (prop != NULL) {
- initrd_start = (unsigned long)
- __va(of_read_ulong(prop, len / 4));
- prop = get_property(of_chosen,
- "linux,initrd-end", &len);
- if (prop != NULL) {
- initrd_end = (unsigned long)
- __va(of_read_ulong(prop, len / 4));
- initrd_below_start_ok = 1;
- } else
- initrd_start = 0;
- }
- }
+ DBG(" -> check_for_initrd() initrd_start=0x%lx initrd_end=0x%lx\n",
+ initrd_start, initrd_end);
/* If we were passed an initrd, set the ROOT_DEV properly if the values
* look sensible. If not, clear initrd reference.
next prev parent reply other threads:[~2007-03-05 3:24 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-05 3:23 [0/15] Ebony support, spin 3 David Gibson
2007-03-05 3:24 ` [PATCH 1/15] powerpc: Allow duplicate lmb_reserve() calls David Gibson
2007-03-05 3:24 ` [PATCH 3/15] Define FIXED_PORT flag for serial_core David Gibson
2007-03-05 3:24 ` David Gibson [this message]
2007-04-18 11:43 ` [PATCH 2/15] Automatically lmb_reserve() initrd Uytterhoeven, Geert
2007-03-05 3:24 ` [PATCH 6/15] zImage: Add more flexible gunzip convenience functions David Gibson
2007-03-16 16:24 ` Geoff Levand
2007-03-17 12:59 ` David Gibson
2007-03-05 3:24 ` [PATCH 10/15] Add device tree for Ebony David Gibson
2007-03-05 14:23 ` Josh Boyer
2007-03-06 0:04 ` David Gibson
2007-03-05 3:24 ` [PATCH 9/15] Add arch/powerpc driver for UIC, PPC4xx interrupt controller David Gibson
2007-03-05 3:24 ` [PATCH 8/15] zImage: Cleanup and improve zImage entry point David Gibson
2007-03-15 22:35 ` Mark A. Greer
2007-03-16 0:14 ` David Gibson
2007-03-16 1:01 ` Mark A. Greer
2007-03-16 1:50 ` David Gibson
2007-03-16 3:36 ` Mark A. Greer
2007-03-20 20:20 ` Mark A. Greer
2007-03-15 23:02 ` Mark A. Greer
2007-03-16 0:18 ` David Gibson
2007-03-16 0:47 ` Mark A. Greer
2007-03-16 0:50 ` David Gibson
2007-03-16 3:45 ` Mark A. Greer
2007-03-16 4:02 ` David Gibson
2007-03-16 16:21 ` Scott Wood
2007-03-17 1:38 ` David Gibson
2007-03-17 3:15 ` Geoff Levand
2007-03-19 15:06 ` Scott Wood
2007-03-20 0:45 ` David Gibson
2007-03-05 3:24 ` [PATCH 4/15] Use resource_size_t for serial port IO addresses David Gibson
2007-03-05 3:24 ` [PATCH 11/15] zImage wrapper for Ebony David Gibson
2007-03-05 17:10 ` Mark A. Greer
2007-03-06 0:09 ` David Gibson
2007-03-07 19:47 ` Scott Wood
2007-03-08 0:24 ` David Gibson
2007-03-08 0:54 ` Mark A. Greer
2007-03-08 1:35 ` Josh Boyer
2007-03-09 17:50 ` Josh Boyer
2007-03-10 4:08 ` David Gibson
2007-03-05 3:24 ` [PATCH 5/15] Re-organize Kconfig code for 4xx in arch/powerpc David Gibson
2007-03-05 3:24 ` [PATCH 7/15] zImage: Cleanup and improve prep_kernel() David Gibson
2007-03-05 3:24 ` [PATCH 15/15] Add support for reset on Ebony David Gibson
2007-03-05 3:24 ` [PATCH 14/15] Early serial debug support for PPC44x David Gibson
2007-03-08 19:44 ` Josh Boyer
2007-03-09 17:42 ` Josh Boyer
2007-03-09 23:43 ` David Gibson
2007-03-05 3:24 ` [PATCH 12/15] Support for Ebony in arch/powerpc David Gibson
2007-03-05 3:24 ` [PATCH 13/15] Port 44x MMU definitions to ARCH=powerpc David Gibson
2007-03-05 8:02 ` Real time clock support in arch/powerpc Zang Roy-r61911
2007-03-05 15:10 ` Kumar Gala
2007-03-05 17:04 ` Mark A. Greer
2007-03-05 13:57 ` [0/15] Ebony support, spin 3 Josh Boyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070305032450.44F57DDF1B@ozlabs.org \
--to=david@gibson.dropbear.id.au \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).