mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/4] fdt: Do not reserve device tree blob
Date: Thu, 19 Oct 2023 13:27:24 +0200	[thread overview]
Message-ID: <20231019112727.3876442-1-s.hauer@pengutronix.de> (raw)

As a matter of fact the reservation is buggy. fdt_add_reserve_map()
added the reservation for the address the fdt currently is placed,
but the fdt is relocated in bootm_load_devicetree() later. This means
we just add a reserve region for some arbitrary piece of memory which
can equally well be removed.

Linux doesn't require reserving the device tree blob. Some architectures
use early_init_fdt_reserve_self() to mark the fdt as reserved, some like
arm64 use architecture code to reserve the region, others like arm move
the fdt away.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/fdt.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 9d72fafd36..734dbfc92a 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -554,9 +554,7 @@ void of_clean_reserve_map(void)
  * @__fdt: The devicetree blob
  *
  * This adds the reservemap entries previously collected in
- * of_add_reserve_entry() to a devicetree binary blob. This also
- * adds the devicetree itself to the reserved list, so after calling
- * this function the tree should not be relocated anymore.
+ * of_add_reserve_entry() to a devicetree binary blob.
  */
 void fdt_add_reserve_map(void *__fdt)
 {
@@ -584,10 +582,6 @@ void fdt_add_reserve_map(void *__fdt)
 		fdt_res++;
 	}
 
-	of_write_number(&fdt_res->address, (unsigned long)__fdt, 2);
-	of_write_number(&fdt_res->size, be32_to_cpu(fdt->totalsize), 2);
-	fdt_res++;
-
 	of_write_number(&fdt_res->address, 0, 2);
 	of_write_number(&fdt_res->size, 0, 2);
 }
-- 
2.39.2




             reply	other threads:[~2023-10-19 11:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 11:27 Sascha Hauer [this message]
2023-10-19 11:27 ` [PATCH 2/4] bootm: print memreserve map in verbose mode Sascha Hauer
2023-10-19 11:27 ` [PATCH 3/4] arm: layerscape: ppa: reserve SDRAM region for PPA Sascha Hauer
2023-10-19 11:27 ` [PATCH 4/4] arm: layerscape: ppa: Add PPA as /reserved-memory/ppa node Sascha Hauer

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=20231019112727.3876442-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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