From: Michael Neuling <mikey@neuling.org>
To: linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: [PATCH] powerpc: Auto reserve of device tree blob
Date: Thu, 18 May 2006 17:03:05 -0500 [thread overview]
Message-ID: <20060518220408.49C6567A44@ozlabs.org> (raw)
In-Reply-To: 5148225C-AE27-4365-A1C2-40C46491AF0D@watson.ibm.com
From: Jimi Xenidis <jimix@watson.ibm.com>
A devtree compiler (dtc) generated devtree blob is "relocatable" and so
does not contain a reserved_map entry for the blob itself. This means
that if passed to Linux, Linux will not get lmb_reserve() the blob and
it could be over. The following patch will explicitly reserve the
"blob" as it was given to us and stops prom_init.c from creating a
reserved mapping for the blob.
NOTE: that the dtc/kexec should not generate the blob reservation entry.
Although if they do, LMB reserver handles overlaps.
Signed-off-by: <jimix@watson.ibm.com>
Acked-by: Michael Neuling <mikey@neuling.org>
---
After some discussion last time, it seemed this was the right was to do
this. I'll post the kexec cleanups if/when this gets upstream.
Mikey
arch/powerpc/kernel/prom.c | 5 +++++
arch/powerpc/kernel/prom_init.c | 9 ++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
Index: linux-2.6-powerpc/arch/powerpc/kernel/prom.c
===================================================================
--- linux-2.6-powerpc.orig/arch/powerpc/kernel/prom.c
+++ linux-2.6-powerpc/arch/powerpc/kernel/prom.c
@@ -1240,6 +1240,11 @@ static void __init early_reserve_mem(voi
reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
initial_boot_params->off_mem_rsvmap);
+
+ /* before we do anything, lets reserve the dt blob */
+ lmb_reserve(__pa((unsigned long)initial_boot_params),
+ initial_boot_params->totalsize);
+
#ifdef CONFIG_PPC32
/*
* Handle the case where we might be booting from an old kexec
Index: linux-2.6-powerpc/arch/powerpc/kernel/prom_init.c
===================================================================
--- linux-2.6-powerpc.orig/arch/powerpc/kernel/prom_init.c
+++ linux-2.6-powerpc/arch/powerpc/kernel/prom_init.c
@@ -2031,11 +2031,7 @@ static void __init flatten_device_tree(v
/* Version 16 is not backward compatible */
hdr->last_comp_version = 0x10;
- /* Reserve the whole thing and copy the reserve map in, we
- * also bump mem_reserve_cnt to cause further reservations to
- * fail since it's too late.
- */
- reserve_mem(RELOC(dt_header_start), hdr->totalsize);
+ /* Copy the reserve map in */
memcpy(rsvmap, RELOC(mem_reserve_map), sizeof(mem_reserve_map));
#ifdef DEBUG_PROM
@@ -2048,6 +2044,9 @@ static void __init flatten_device_tree(v
RELOC(mem_reserve_map)[i].size);
}
#endif
+ /* Bump mem_reserve_cnt to cause further reservations to fail
+ * since it's too late.
+ */
RELOC(mem_reserve_cnt) = MEM_RESERVE_MAP_SIZE;
prom_printf("Device tree strings 0x%x -> 0x%x\n",
next prev parent reply other threads:[~2006-05-18 22:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-13 2:05 [patch][rfc]flattened device tree: Passing a dtb (blob) to Linux Jimi Xenidis
2006-04-13 2:15 ` Jimi Xenidis
2006-04-13 5:36 ` Michael Neuling
2006-04-13 10:37 ` Jimi Xenidis
2006-04-13 11:07 ` Michael Ellerman
2006-04-13 13:19 ` Jimi Xenidis
2006-04-13 14:34 ` Michael Ellerman
2006-04-18 16:48 ` Jon Loeliger
2006-04-18 18:04 ` Michael Ellerman
2006-04-18 18:42 ` Jimi Xenidis
2006-04-20 15:42 ` Jon Loeliger
2006-04-20 20:20 ` Mark A. Greer
2006-04-13 23:12 ` Benjamin Herrenschmidt
2006-04-14 12:45 ` Jimi Xenidis
2006-04-14 16:19 ` Michael Ellerman
2006-05-18 22:03 ` Michael Neuling [this message]
2006-05-22 16:25 ` [PATCH] powerpc: Auto reserve of device tree blob Jon Loeliger
2006-05-23 15:04 ` Jon Loeliger
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=20060518220408.49C6567A44@ozlabs.org \
--to=mikey@neuling.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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).