[PATCH 1/4] fdt: Do not reserve device tree blob

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 19 04:27:24 PDT 2023


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 at 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




More information about the barebox mailing list