Skip to contentSkip to conversation

ppc: Re-order ramdisk/fdt handling sequence

PATCH Superseded Kumar Gala 5 participants 20 messages Feb 18, 2008 – Feb 27, 2008

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Doing the fdt before the ramdisk allows us to grow the fdt w/o concern however it does mean we have to go in and fixup the initrd info since we don't know where it will be.

---

Fixed up the error handling. The old code tried returning an error and should have called do_reset().

 lib_ppc/bootm.c |   40 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 5 deletions(-)
lib_ppc/bootm.c +35 -5
index 5158ccc..09e349e 100644
@@ -71,7 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	bd_t	*kbd;
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
 
-	int	has_of = 0;
+	int	ret, has_of = 0;
 
 #if defined(CONFIG_OF_LIBFDT)
 	char	*of_flat_tree;
@@ -121,9 +121,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 
 	rd_len = rd_data_end - rd_data_start;
 
-	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
-			sp_limit, get_sp (), &initrd_start, &initrd_end);
-
 #if defined(CONFIG_OF_LIBFDT)
 	/* find flattened device tree */
 	alloc_current = get_fdt (alloc_current,
@@ -134,7 +131,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	 * if the user wants it (the logic is in the subroutines).
 	 */
 	if (of_flat_tree) {
-		if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
+		/* pass in dummy initrd info, we'll fix up later */
+		if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end, 0) < 0) {
 			fdt_error ("/chosen node create failed");
 			do_reset (cmdtp, flag, argc, argv);
 		}
@@ -157,6 +155,38 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	}
 #endif	/* CONFIG_OF_LIBFDT */
 
+	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
+			sp_limit, get_sp (), &initrd_start, &initrd_end);
+
+#if defined(CONFIG_OF_LIBFDT)
+	/* fixup the initrd now that we know where it should be */
+	if ((of_flat_tree) && (initrd_start && initrd_end)) {
+		uint64_t addr, size;
+		int  total = fdt_num_mem_rsv(of_flat_tree);
+		int  j;
+
+		/* Look for the dummy entry and delete it */
+		for (j = 0; j < total; j++) {
+			fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+			if (addr == rd_data_start) {
+				fdt_del_mem_rsv(of_flat_tree, j);
+				break;
+			}
+		}
+
+		ret = fdt_add_mem_rsv(of_flat_tree, initrd_start,
+					initrd_end - initrd_start + 1);
+		if (ret < 0) {
+			printf("fdt_chosen: %s\n", fdt_strerror(ret));
+			do_reset (cmdtp, flag, argc, argv);
+		}
+
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-start", initrd_start, 0);
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-end", initrd_end, 0);
+	}
+#endif
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 
Signature · 1 line
1.5.3.8
#1 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 5 lines · Kumar Gala

Doing the fdt before the ramdisk allows us to grow the fdt w/o concern however it does mean we have to go in and fixup the initrd info since we don't know where it will be.

Hi Kumar,

Quoted 13 lines

---

Fixed up the error handling. The old code tried returning an error and should have called do_reset().

 lib_ppc/bootm.c |   40 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 5 deletions(-)
lib_ppc/bootm.c +0 -0
index 5158ccc..09e349e 100644

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 74

Quoted 5 lines
lib_ppc/bootm.c +1 -1
@@ -71,7 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	bd_t	*kbd;
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
 
-	int	has_of = 0;
+	int	ret, has_of = 0;

I would strongly prefer to see "ret" declared on a separate line. I'm not a fan of comma declared variables and, when one is initialized and the other isn't, it makes my brain play tricks on me (thinking ret is initialized to 0 too, which it isn't).

Quoted 14 lines
lib_ppc/bootm.c +0 -3
 #if defined(CONFIG_OF_LIBFDT)
 	char	*of_flat_tree;
@@ -121,9 +121,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 
 	rd_len = rd_data_end - rd_data_start;
 
-	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
-			sp_limit, get_sp (), &initrd_start, &initrd_end);
-
 #if defined(CONFIG_OF_LIBFDT)
 	/* find flattened device tree */
 	alloc_current = get_fdt (alloc_current,

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 135

Quoted 6 lines
lib_ppc/bootm.c +2 -1
@@ -134,7 +131,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	 * if the user wants it (the logic is in the subroutines).
 	 */
 	if (of_flat_tree) {
-		if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
+		/* pass in dummy initrd info, we'll fix up later */
+		if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end, 0) < 0) {

If you pass in 0,0 for rd_data_start, rd_data_end it will not create the ramdisk entry...

Quoted 15 lines
lib_ppc/bootm.c +8 -0
 			fdt_error ("/chosen node create failed");
 			do_reset (cmdtp, flag, argc, argv);
 		}
@@ -157,6 +155,38 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	}
 #endif	/* CONFIG_OF_LIBFDT */
 
+	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
+			sp_limit, get_sp (), &initrd_start, &initrd_end);
+
+#if defined(CONFIG_OF_LIBFDT)
+	/* fixup the initrd now that we know where it should be */
+	if ((of_flat_tree) && (initrd_start && initrd_end)) {
+		uint64_t addr, size;
+		int  total = fdt_num_mem_rsv(of_flat_tree);

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 175

Quoted 10 lines
lib_ppc/bootm.c +10 -0
+		int  j;
+
+		/* Look for the dummy entry and delete it */
+		for (j = 0; j < total; j++) {
+			fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+			if (addr == rd_data_start) {
+				fdt_del_mem_rsv(of_flat_tree, j);
+				break;
+			}
+		}

...and the above loop and delete will then be unnecessary.

Quoted 6 lines
lib_ppc/bootm.c +6 -0
+		ret = fdt_add_mem_rsv(of_flat_tree, initrd_start,
+					initrd_end - initrd_start + 1);
+		if (ret < 0) {
+			printf("fdt_chosen: %s\n", fdt_strerror(ret));
+			do_reset (cmdtp, flag, argc, argv);
+		}

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 192

Quoted 10 lines
lib_ppc/bootm.c +7 -0
+
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-start", initrd_start, 0);
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-end", initrd_end, 0);
+	}
+#endif
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
 

...and you will have to pass in '1' for the create (last) parameter in the do_fixup_by_path_u32() calls to create them if they don't exist.

Is that better, or just a different way to do the same thing? It seems more straight-forward to me.

Best regards,
gvb

author
#2 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 42 lines · Jerry Van Baren
Quoted 5 lines · Kumar Gala

Doing the fdt before the ramdisk allows us to grow the fdt w/o concern
however it does mean we have to go in and fixup the initrd info since we don't know where it will be.

Hi Kumar,

Quoted 11 lines

---
Fixed up the error handling. The old code tried returning an error and
should have called do_reset().
lib_ppc/bootm.c | 40 +++++++++++++++++++++++++++++++++++-----

1 files changed, 35 insertions(+), 5 deletions(-)
lib_ppc/bootm.c +0 -0
index 5158ccc..09e349e 100644

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 73

Quoted 4 lines
lib_ppc/bootm.c +1 -1
@@ -71,7 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	bd_t	*kbd;
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
-	int	has_of = 0;
+	int	ret, has_of = 0;

I would strongly prefer to see "ret" declared on a separate line. I'm not a fan of comma declared variables and, when one is initialized and the other isn't, it makes my brain play tricks on me (thinking ret is initialized to 0 too, which it isn't).

Quoted 12 lines
lib_ppc/bootm.c +0 -3
 #if defined(CONFIG_OF_LIBFDT)
 	char	*of_flat_tree;
@@ -121,9 +121,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	rd_len = rd_data_end - rd_data_start;
-	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
-			sp_limit, get_sp (), &initrd_start, &initrd_end);
-
 #if defined(CONFIG_OF_LIBFDT)
 	/* find flattened device tree */
 	alloc_current = get_fdt (alloc_current,
@@ -134,7 +131,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	 * if the user wants it (the logic is in the subroutines).
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 135

Quoted 5 lines
lib_ppc/bootm.c +2 -1
 	 */
 	if (of_flat_tree) {
-		if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 0) {
+		/* pass in dummy initrd info, we'll fix up later */
+		if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end, 0) < 0) {

If you pass in 0,0 for rd_data_start, rd_data_end it will not create the ramdisk entry...

If rd_data_start, rd_data_end are 0,0 than we don't have a ramdisk, so its ok.

Quoted 18 lines
Quoted 18 lines
lib_ppc/bootm.c +12 -0
 			fdt_error ("/chosen node create failed");
 			do_reset (cmdtp, flag, argc, argv);
 		}
@@ -157,6 +155,38 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	}
 #endif	/* CONFIG_OF_LIBFDT */
+	alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
+			sp_limit, get_sp (), &initrd_start, &initrd_end);
+
+#if defined(CONFIG_OF_LIBFDT)
+	/* fixup the initrd now that we know where it should be */
+	if ((of_flat_tree) && (initrd_start && initrd_end)) {
+		uint64_t addr, size;
+		int  total = fdt_num_mem_rsv(of_flat_tree);
+		int  j;
+
+		/* Look for the dummy entry and delete it */
+		for (j = 0; j < total; j++) {
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 175

Quoted 6 lines
lib_ppc/bootm.c +6 -0
+			fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+			if (addr == rd_data_start) {
+				fdt_del_mem_rsv(of_flat_tree, j);
+				break;
+			}
+		}

...and the above loop and delete will then be unnecessary.

Again, protected by initrd_start/_end being non-zero.

Quoted 11 lines
Quoted 11 lines
lib_ppc/bootm.c +11 -0
+		ret = fdt_add_mem_rsv(of_flat_tree, initrd_start,
+					initrd_end - initrd_start + 1);
+		if (ret < 0) {
+			printf("fdt_chosen: %s\n", fdt_strerror(ret));
+			do_reset (cmdtp, flag, argc, argv);
+		}
+
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-start", initrd_start, 0);
+		do_fixup_by_path_u32(of_flat_tree, "/chosen",
+					"linux,initrd-end", initrd_end, 0);
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 191

Quoted 4 lines
lib_ppc/bootm.c +2 -0
+	}
+#endif
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);

...and you will have to pass in '1' for the create (last) parameter in the do_fixup_by_path_u32() calls to create them if they don't exist.

They should exist by the time we are doing the fixup.

Quoted 2 lines

Is that better, or just a different way to do the same thing? It seems more straight-forward to me.

Its just re-ordering the way we do things.

- k

#3 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 54 lines · Kumar Gala
Quoted 42 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala

Doing the fdt before the ramdisk allows us to grow the fdt w/o concern however it does mean we have to go in and fixup the initrd info since we don't know where it will be.

Hi Kumar,

Quoted 10 lines

---
Fixed up the error handling. The old code tried returning an error and should have called do_reset().
lib_ppc/bootm.c | 40 +++++++++++++++++++++++++++++++++++-----

1 files changed, 35 insertions(+), 5 deletions(-)
lib_ppc/bootm.c +0 -0
index 5158ccc..09e349e 100644

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 73

Quoted 4 lines
lib_ppc/bootm.c +1 -1
@@ -71,7 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
    bd_t    *kbd;
    void    (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
-    int    has_of = 0;
+    int    ret, has_of = 0;

I would strongly prefer to see "ret" declared on a separate line. I'm not a fan of comma declared variables and, when one is initialized and the other isn't, it makes my brain play tricks on me (thinking ret is initialized to 0 too, which it isn't).

Quoted 14 lines
lib_ppc/bootm.c +0 -3
 #if defined(CONFIG_OF_LIBFDT)
    char    *of_flat_tree;
@@ -121,9 +121,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
    rd_len = rd_data_end - rd_data_start;
-    alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
-            sp_limit, get_sp (), &initrd_start, &initrd_end);
-
 #if defined(CONFIG_OF_LIBFDT)
    /* find flattened device tree */
    alloc_current = get_fdt (alloc_current,
@@ -134,7 +131,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
     * if the user wants it (the logic is in the subroutines).
     */
    if (of_flat_tree) {
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 137

Quoted 5 lines
lib_ppc/bootm.c +2 -1
-        if (fdt_chosen(of_flat_tree, initrd_start, initrd_end, 0) < 
 0) {
+        /* pass in dummy initrd info, we'll fix up later */
+        if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end, 0) 
 < 0) {

If you pass in 0,0 for rd_data_start, rd_data_end it will not create the ramdisk entry...

Quoted 2 lines

If rd_data_start, rd_data_end are 0,0 than we don't have a ramdisk, so its ok.

My point is to pass in 0,0 *so that* they are not created at all, rather than passing in dummy values, creating entries that we have to delete/rewrite later.

Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
lib_ppc/bootm.c +0 -0
            fdt_error ("/chosen node create failed");
            do_reset (cmdtp, flag, argc, argv);
        }
lib_ppc/bootm.c +12 -0
@@ -157,6 +155,38 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
    }
 #endif    /* CONFIG_OF_LIBFDT */
+    alloc_current = ramdisk_high (alloc_current, rd_data_start, rd_len,
+            sp_limit, get_sp (), &initrd_start, &initrd_end);
+
+#if defined(CONFIG_OF_LIBFDT)
+    /* fixup the initrd now that we know where it should be */
+    if ((of_flat_tree) && (initrd_start && initrd_end)) {
+        uint64_t addr, size;
+        int  total = fdt_num_mem_rsv(of_flat_tree);
+        int  j;
+
+        /* Look for the dummy entry and delete it */
+        for (j = 0; j < total; j++) {
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 175

Quoted 6 lines
lib_ppc/bootm.c +6 -0
+            fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+            if (addr == rd_data_start) {
+                fdt_del_mem_rsv(of_flat_tree, j);
+                break;
+            }
+        }

...and the above loop and delete will then be unnecessary.

Quoted 1 line

Again, protected by initrd_start/_end being non-zero.

My point is to pass in 0,0 *so that* they are not created at all, rather than passing in dummy values, creating entries that we have to delete/rewrite later.

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
lib_ppc/bootm.c +10 -0
+        ret = fdt_add_mem_rsv(of_flat_tree, initrd_start,
+                    initrd_end - initrd_start + 1);
+        if (ret < 0) {
+            printf("fdt_chosen: %s\n", fdt_strerror(ret));
+            do_reset (cmdtp, flag, argc, argv);
+        }
+
+        do_fixup_by_path_u32(of_flat_tree, "/chosen",
+                    "linux,initrd-start", initrd_start, 0);
+        do_fixup_by_path_u32(of_flat_tree, "/chosen",
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 191

Quoted 5 lines
lib_ppc/bootm.c +3 -0
+                    "linux,initrd-end", initrd_end, 0);
+    }
+#endif
    debug ("## Transferring control to Linux (at address %08lx) ...\n",
        (ulong)kernel);

...and you will have to pass in '1' for the create (last) parameter in the do_fixup_by_path_u32() calls to create them if they don't exist.

Quoted 8 lines

They should exist by the time we are doing the fixup.

Quoted 2 lines

Is that better, or just a different way to do the same thing? It seems more straight-forward to me.

Its just re-ordering the way we do things.

- k

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Best regards,
gvb

author
#4 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 126 lines · Jerry Van Baren
Quoted 55 lines · Kumar Gala
Quoted 46 lines · Jerry Van Baren
Quoted 6 lines · Kumar Gala

Doing the fdt before the ramdisk allows us to grow the fdt w/o concern
however it does mean we have to go in and fixup the initrd info since
we don't know where it will be.

Hi Kumar,

Quoted 11 lines

---
Fixed up the error handling. The old code tried returning an error and
should have called do_reset().
lib_ppc/bootm.c | 40 +++++++++++++++++++++++++++++++++++-----

1 files changed, 35 insertions(+), 5 deletions(-)
lib_ppc/bootm.c +0 -0
index 5158ccc..09e349e 100644

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 73

Quoted 4 lines
lib_ppc/bootm.c +1 -1
@@ -71,7 +71,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
   bd_t    *kbd;
   void    (*kernel)(bd_t *, ulong, ulong, ulong, ulong);
-    int    has_of = 0;
+    int    ret, has_of = 0;

I would strongly prefer to see "ret" declared on a separate line. I'm not a fan of comma declared variables and, when one is initialized and the other isn't, it makes my brain play tricks on me (thinking ret is initialized to 0 too, which it isn't).

Quoted 15 lines
lib_ppc/bootm.c +0 -3
 #if defined(CONFIG_OF_LIBFDT)
   char    *of_flat_tree;
@@ -121,9 +121,6 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
   rd_len = rd_data_end - rd_data_start;
-    alloc_current = ramdisk_high (alloc_current, rd_data_start,  
 rd_len,
-            sp_limit, get_sp (), &initrd_start, &initrd_end);
-
 #if defined(CONFIG_OF_LIBFDT)
   /* find flattened device tree */
   alloc_current = get_fdt (alloc_current,
@@ -134,7 +131,8 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
    * if the user wants it (the logic is in the subroutines).
    */
   if (of_flat_tree) {
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 137

Quoted 5 lines
lib_ppc/bootm.c +2 -1
-        if (fdt_chosen(of_flat_tree, initrd_start, initrd_end,  
 0) < 0) {
+        /* pass in dummy initrd info, we'll fix up later */
+        if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end,  
 0) < 0) {

If you pass in 0,0 for rd_data_start, rd_data_end it will not create the ramdisk entry...

Quoted 2 lines

If rd_data_start, rd_data_end are 0,0 than we don't have a ramdisk, so its ok.

My point is to pass in 0,0 *so that* they are not created at all, rather than passing in dummy values, creating entries that we have to delete/rewrite later.

Quoted 27 lines
Quoted 19 lines
Quoted 19 lines
lib_ppc/bootm.c +0 -0
           fdt_error ("/chosen node create failed");
           do_reset (cmdtp, flag, argc, argv);
       }
lib_ppc/bootm.c +12 -0
@@ -157,6 +155,38 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
   }
 #endif    /* CONFIG_OF_LIBFDT */
+    alloc_current = ramdisk_high (alloc_current, rd_data_start,  
 rd_len,
+            sp_limit, get_sp (), &initrd_start, &initrd_end);
+
+#if defined(CONFIG_OF_LIBFDT)
+    /* fixup the initrd now that we know where it should be */
+    if ((of_flat_tree) && (initrd_start && initrd_end)) {
+        uint64_t addr, size;
+        int  total = fdt_num_mem_rsv(of_flat_tree);
+        int  j;
+
+        /* Look for the dummy entry and delete it */
+        for (j = 0; j < total; j++) {
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 175

Quoted 6 lines
lib_ppc/bootm.c +6 -0
+            fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+            if (addr == rd_data_start) {
+                fdt_del_mem_rsv(of_flat_tree, j);
+                break;
+            }
+        }

...and the above loop and delete will then be unnecessary.

Quoted 1 line

Again, protected by initrd_start/_end being non-zero.

My point is to pass in 0,0 *so that* they are not created at all, rather than passing in dummy values, creating entries that we have to delete/rewrite later.

Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
lib_ppc/bootm.c +12 -0
+        ret = fdt_add_mem_rsv(of_flat_tree, initrd_start,
+                    initrd_end - initrd_start + 1);
+        if (ret < 0) {
+            printf("fdt_chosen: %s\n", fdt_strerror(ret));
+            do_reset (cmdtp, flag, argc, argv);
+        }
+
+        do_fixup_by_path_u32(of_flat_tree, "/chosen",
+                    "linux,initrd-start", initrd_start, 0);
+        do_fixup_by_path_u32(of_flat_tree, "/chosen",
+                    "linux,initrd-end", initrd_end, 0);
+    }
Quoted 8 lines

lib_ppc/bootm.c do_bootm_linux(cmd_tbl_t *cmdtp, int flag, · line 191

Quoted 4 lines
lib_ppc/bootm.c +1 -0
+#endif
   debug ("## Transferring control to Linux (at address %08lx) ... 
 \n",
       (ulong)kernel);

...and you will have to pass in '1' for the create (last) parameter in the do_fixup_by_path_u32() calls to create them if they don't exist.

Quoted 5 lines

They should exist by the time we are doing the fixup.

Quoted 2 lines

Is that better, or just a different way to do the same thing? It seems more straight-forward to me.

Its just re-ordering the way we do things.
- k

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

Quoted 6 lines

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.

- k

#5 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 6 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 11 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.

- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

Thanks,
gvb

author
#6 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 26 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 10 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Quoted 8 lines

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

- k

#7 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 3 lines · In message <[email protected]> you wrote:

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

So what is the state of this patch now? Will it go in through the FDT custodian repo, or has it been rejected, or am I supposed to apply it directly? Or?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Eureka!                                                 -- Archimedes
#8 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 11 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

So what is the state of this patch now? Will it go in through the FDT custodian repo, or has it been rejected, or am I supposed to apply it directly? Or?

Best regards,

Wolfgang Denk

Hi Wolfgang, Kumar,

Most of the email exchanges were with me and the patch is fine IMHO.

I was expecting it to go through the "new-image" custodian, but I would be happy to apply it to the u-boot-fdt repo and push it up from there.

Preferences, Kumar?

Best regards,
gvb

#9 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 7 lines · Jerry Van Baren
Quoted 6 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

So what is the state of this patch now? Will it go in through the FDT custodian repo, or has it been rejected, or am I supposed to apply it directly? Or?

[...]

Quoted 4 lines

Most of the email exchanges were with me and the patch is fine IMHO.

I was expecting it to go through the "new-image" custodian, but I would be happy to apply it to the u-boot-fdt repo and push it up from there.

Jerry, Kumar,

I think it would be better to have this patch (and other ones by Kumar that touch booting-related code) go through the new-image branch. Otherwise we'll have merge conflicts down the road, especially since we've got a big patch coming, that adds framework for new image handling. I'd like to have this framework patch merged first, then take care of (re-based) boot-related patches that have been posted recently.

Regards,
Bartlomiej

author
#10 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 19 lines · Bartlomiej Sieka
Quoted 10 lines · Jerry Van Baren
Quoted 9 lines · Wolfgang Denk

In message <8B11A571-3BC2-42BD-9B66-

Quoted 2 lines · DF22A736A3A7 at kernel.crashing.org> you wrote:

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

So what is the state of this patch now? Will it go in through the FDT
custodian repo, or has it been rejected, or am I supposed to apply it
directly? Or?

[...]

Quoted 4 lines

Most of the email exchanges were with me and the patch is fine IMHO. I was expecting it to go through the "new-image" custodian, but I would be happy to apply it to the u-boot-fdt repo and push it up from there.

Jerry, Kumar,

Quoted 8 lines

I think it would be better to have this patch (and other ones by Kumar that touch booting-related code) go through the new-image branch. Otherwise we'll have merge conflicts down the road, especially since we've got a big patch coming, that adds framework for new image handling. I'd like to have this framework patch merged first, then take
care of (re-based) boot-related patches that have been posted recently.

Agreed. Was off having some fun for a few days.

I think going through the new image tree is best.

- k

#11 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

In reply to Kumar Gala
Quoted 30 lines · Kumar Gala
Quoted 28 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 10 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

Quoted 7 lines
Quoted 4 lines

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

But we don't really grow the blob, we are just allocating the space for the initrd properties - *if* the blob already has enough free space. If the blob does not have enough free space we'll hit the bottom anyway, whether in fdt_chosen() or ft_board_setup(), so it seem that it doesn't matter whether we pre-allocate space for initrd or not. Or am I missing something?

I was rather thinking of increasing the total blob size when relocating it. Currently relocation happens only when the blob is not within BOOTMAPSZ region, so we would need to always relocate the blob and figure out the size delta: (1) get it from env variable, if set (2) or use some default delta. What do you think?

Cheers,
m.

#12 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 45 lines · Marian Balakowicz
Quoted 30 lines · Kumar Gala
Quoted 28 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 10 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

Quoted 6 lines
Quoted 4 lines

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

But we don't really grow the blob, we are just allocating the space for the initrd properties - *if* the blob already has enough free space. If the blob does not have enough free space we'll hit the bottom anyway, whether in fdt_chosen() or ft_board_setup(), so it seem that it doesn't matter whether we pre-allocate space for initrd or not. Or am I missing something?

Quoted 5 lines

I was rather thinking of increasing the total blob size when relocating it. Currently relocation happens only when the blob is not within BOOTMAPSZ region, so we would need to always relocate the blob and figure out the size delta: (1) get it from env variable, if set (2) or use some default delta. What do you think?

Also, for the blob growing changes it would be nice to first merge your LMB patches to sort out the memory allocation. I didn't have a time to review your changes in detail but it's definitely step in the right direction. Current bootm allocation is pretty messy, I cleaned it a bit but didn't want to touch too many pieces at the same time. For the same reason I would like to finish the current patch I am working on that adds dual format framework before we add LMB and dynamic blob growing.

m.

#13 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

In reply to Marian Balakowicz
Quoted 45 lines · Marian Balakowicz
Quoted 30 lines · Kumar Gala
Quoted 28 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 10 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

Quoted 6 lines
Quoted 4 lines

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

But we don't really grow the blob, we are just allocating the space for the initrd properties - *if* the blob already has enough free space. If the blob does not have enough free space we'll hit the bottom anyway, whether in fdt_chosen() or ft_board_setup(), so it seem that it doesn't matter whether we pre-allocate space for initrd or not. Or am I missing something?

Quoted 8 lines

I was rather thinking of increasing the total blob size when relocating it. Currently relocation happens only when the blob is not within BOOTMAPSZ region, so we would need to always relocate the blob and figure out the size delta: (1) get it from env variable, if set (2) or use some default delta. What do you think?

Cheers,
m.

The missing part is libfdt doesn't exactly support dynamic resizing and our current code doesn't do in-place resizing (which it could do by doing a move to the same location, but with a larger/smaller length).

Kumar is lining up the pieces to get there, but we aren't there yet...

gvb

#14 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 54 lines · Jerry Van Baren
Quoted 46 lines · Marian Balakowicz
Quoted 31 lines · Kumar Gala
Quoted 29 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 10 lines
Quoted 10 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 5 lines

Ahh, the reason I wanted them created was to ensure we have enough size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

Quoted 6 lines
Quoted 4 lines

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

But we don't really grow the blob, we are just allocating the space for the initrd properties - *if* the blob already has enough free space. If the blob does not have enough free space we'll hit the bottom anyway, whether in fdt_chosen() or ft_board_setup(), so it seem that it doesn't matter whether we pre-allocate space for initrd or not. Or am I missing something?

Quoted 6 lines

I was rather thinking of increasing the total blob size when relocating it. Currently relocation happens only when the blob is not within BOOTMAPSZ region, so we would need to always relocate the blob and figure out the size delta: (1) get it from env variable, if set (2) or use some default delta. What do you think?

Quoted 5 lines

The missing part is libfdt doesn't exactly support dynamic resizing and our current code doesn't do in-place resizing (which it could do by doing a move to the same location, but with a larger/smaller length).

Kumar is lining up the pieces to get there, but we aren't there yet...

I see, but how about resizing to a new location:

- err = fdt_open_into (fdt_blob, (void *)of_start, of_len);
+ err = fdt_open_into (fdt_blob, (void *)of_start, of_len + delta);

Should that work?

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size, so I suspect it may impact performance.

m.

author
#15 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 80 lines · Marian Balakowicz
Quoted 64 lines · Jerry Van Baren
Quoted 54 lines · Marian Balakowicz
Quoted 33 lines · Kumar Gala
Quoted 31 lines · Jerry Van Baren
Quoted 4 lines · Kumar Gala
Quoted 3 lines · Jerry Van Baren
Quoted 2 lines · Kumar Gala
Quoted 1 line · Jerry Van Baren

Kumar Gala wrote:

[[[[snip]]]]

Quoted 11 lines
Quoted 11 lines

The patch is creating dummy initrd entries in the reserved map and in /chosen, only to work hard to delete and re-create the reserved map entries and rewrite the /chosen entries.

My counter-proposal is to not bother with dummy values. Simply pass in 0,0 which will prevent the creation of the initrd entries
by fdt_chosen(). By not creating dummy entries, you can simply create the proper entries once you know what the the correct values are, rather than the more complicated rsvmap search & delete + rsvmap creation + /chosen modifications.

Quoted 6 lines

Ahh, the reason I wanted them created was to ensure we have enough
size for them up front rather than figuring that out later. By creating them and replacing them I will not being changing the size at all.
- k

OK, I see.

Currently this isn't an issue because our blob has a fixed size that has free space inside it, so creating the rsvmap and /chosen entries eat at the internal free space and don't change the total blob size.

Quoted 7 lines
Quoted 5 lines

People are advocating dynamically increasing the blob size, which simplifies things for blob generation (don't have to guess how big to make the blob when running the dtc to create it), but that would
cause problems with my counter-proposal.

And the whole point of my patch was to enable the ability to dynamically grow the blob before we do anything w/the ramdisk.

But we don't really grow the blob, we are just allocating the space for
the initrd properties - *if* the blob already has enough free space. If
the blob does not have enough free space we'll hit the bottom anyway,
whether in fdt_chosen() or ft_board_setup(), so it seem that it doesn't
matter whether we pre-allocate space for initrd or not. Or am I missing
something?

Quoted 8 lines

I was rather thinking of increasing the total blob size when relocating
it. Currently relocation happens only when the blob is not within BOOTMAPSZ region, so we would need to always relocate the blob and figure out the size delta: (1) get it from env variable, if set
(2) or
use some default delta. What do you think?

Quoted 7 lines

The missing part is libfdt doesn't exactly support dynamic resizing and
our current code doesn't do in-place resizing (which it could do by doing a move to the same location, but with a larger/smaller length).

Kumar is lining up the pieces to get there, but we aren't there yet...

I see, but how about resizing to a new location:

(quoted diff) +1 -1
-   err = fdt_open_into (fdt_blob, (void *)of_start, of_len);
+   err = fdt_open_into (fdt_blob, (void *)of_start, of_len + delta);

Should that work?

Quoted 9 lines

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size,
so I suspect it may impact performance.

I felt the sequence (on PPC) is either:
kernel, cmdline, kdb, initrd

or

kernel, fdt, initrd

The reason being is that initrd doesn't need to be constrained to BOOTMAPSZ but cmdline, kdb, and fdt would/should be.

- k

#16 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 2 lines · Kumar Gala

On Feb 22, 2008, at 11:08 AM, Marian Balakowicz wrote:

...

Quoted 13 lines
Quoted 9 lines

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size, so I suspect it may impact performance.

I felt the sequence (on PPC) is either:
kernel, cmdline, kdb, initrd

Quoted 6 lines

or

kernel, fdt, initrd

The reason being is that initrd doesn't need to be constrained to BOOTMAPSZ but cmdline, kdb, and fdt would/should be.

That's right.

My point was just to have two steps:

1) Move all the stuff to the final locations (whatever the sequence)

- kernel

- fdt - *always* relocate to within BOOTMAPSZ, increase size dynamically.

fdt blob can be delivered using of the three different methods: (1) raw fdt blob, (2) fdt blob embedded in legacy format uImage, (3) fdt blob embedded in new uImage format. To simplify things always relocate it to a allocated spot within BOOTMAPSZ.

- initrd - within or outside of the BOOTMAPSZ boundaries

2) Update fdt blob, knowing we have enough free blob space: set initrd params, other fixups, etc.

With such approach we don't need special treatment for initrd,start/initrd,end (and other fixups). We assure that there is enough free space in fdt blob when we relocate it.

m.

author
#17 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 45 lines · Marian Balakowicz
Quoted 2 lines · Kumar Gala

On Feb 22, 2008, at 11:08 AM, Marian Balakowicz wrote:

...

Quoted 16 lines
Quoted 12 lines

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting
from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a
new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size,
so I suspect it may impact performance.

I felt the sequence (on PPC) is either:
kernel, cmdline, kdb, initrd

Quoted 6 lines

or

kernel, fdt, initrd

The reason being is that initrd doesn't need to be constrained to BOOTMAPSZ but cmdline, kdb, and fdt would/should be.

That's right.

My point was just to have two steps:

1) Move all the stuff to the final locations (whatever the sequence)

- kernel

- fdt - *always* relocate to within BOOTMAPSZ, increase size dynamically.

fdt blob can be delivered using of the three different methods: (1) raw fdt blob, (2) fdt blob embedded in legacy format uImage, (3) fdt blob embedded in new uImage format. To simplify things always relocate it to a allocated spot within BOOTMAPSZ.

- initrd - within or outside of the BOOTMAPSZ boundaries

Quoted 7 lines

2) Update fdt blob, knowing we have enough free blob space: set initrd params, other fixups, etc.

With such approach we don't need special treatment for initrd,start/initrd,end (and other fixups). We assure that there is enough free space in fdt blob when we relocate it.

How we get the fdt blob doesn't matter as much as its size. At this point we still don't know how large it might need to be. I think the changes I made make sense in that we'd want to process the majority of the fdt before we do anything w/the initrd.

We can cleanup the fixup once we have better support for dealing w/the sizing of the fdt.

- k

#18 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 49 lines · Kumar Gala
Quoted 46 lines · Marian Balakowicz
Quoted 2 lines · Kumar Gala

On Feb 22, 2008, at 11:08 AM, Marian Balakowicz wrote:

...

Quoted 14 lines
Quoted 10 lines

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size,
so I suspect it may impact performance.

I felt the sequence (on PPC) is either:
kernel, cmdline, kdb, initrd

Quoted 6 lines

or

kernel, fdt, initrd

The reason being is that initrd doesn't need to be constrained to BOOTMAPSZ but cmdline, kdb, and fdt would/should be.

That's right.

My point was just to have two steps:

1) Move all the stuff to the final locations (whatever the sequence)

- kernel

- fdt - *always* relocate to within BOOTMAPSZ, increase size dynamically.

fdt blob can be delivered using of the three different methods: (1) raw fdt blob, (2) fdt blob embedded in legacy format uImage, (3) fdt blob embedded in new uImage format. To simplify things always relocate it to a allocated spot within BOOTMAPSZ.

- initrd - within or outside of the BOOTMAPSZ boundaries

2) Update fdt blob, knowing we have enough free blob space: set initrd params, other fixups, etc.

Quoted 8 lines
Quoted 3 lines

With such approach we don't need special treatment for initrd,start/initrd,end (and other fixups). We assure that there is enough free space in fdt blob when we relocate it.

How we get the fdt blob doesn't matter as much as its size. At this point we still don't know how large it might need to be. I think the changes I made make sense in that we'd want to process the majority of the fdt before we do anything w/the initrd.

Correct me if I am wrong but my understanding is that it will not help if the total size of the blob is too small.

It will just use/allocate free internal blob space - if the internal free space is sufficient. And if it is it can be used at any time. If it is not sufficient, then we need to grow the blob total size first.

m.

author
#19 lore raw

PATCH v2 1/1 ppc: Re-order ramdisk/fdt handling sequence

Quoted 65 lines · Marian Balakowicz
Quoted 58 lines · Kumar Gala
Quoted 46 lines · Marian Balakowicz
Quoted 2 lines · Kumar Gala

On Feb 22, 2008, at 11:08 AM, Marian Balakowicz wrote:

...

Quoted 16 lines
Quoted 12 lines

If we add LMB and rework bootm memory allocation, putting things (kernel, cmdline, kdb, initrd (optionally), fdt) in sequence starting
from bootm_low then we may want to always relocate fdt to avoid overlapping. And, in case of new uImage FDT blob will be embedded in a
new uImage shell which is a blob itself. So, in this case in-place resizing is not really a clean option, we would need to resize the embedding new uImage blob first, and this one may have significant size,
so I suspect it may impact performance.

I felt the sequence (on PPC) is either:
kernel, cmdline, kdb, initrd

Quoted 6 lines

or

kernel, fdt, initrd

The reason being is that initrd doesn't need to be constrained to BOOTMAPSZ but cmdline, kdb, and fdt would/should be.

That's right.

My point was just to have two steps:

1) Move all the stuff to the final locations (whatever the sequence)

- kernel

- fdt - *always* relocate to within BOOTMAPSZ, increase size dynamically.

fdt blob can be delivered using of the three different methods: (1) raw fdt blob, (2) fdt blob embedded in legacy format uImage, (3) fdt blob embedded in new uImage format. To simplify things always relocate
it to a allocated spot within BOOTMAPSZ.

- initrd - within or outside of the BOOTMAPSZ boundaries

Quoted 8 lines

2) Update fdt blob, knowing we have enough free blob space: set initrd
params, other fixups, etc.

With such approach we don't need special treatment for initrd,start/initrd,end (and other fixups). We assure that there is enough free space in fdt blob when we relocate it.

Quoted 5 lines

How we get the fdt blob doesn't matter as much as its size. At this point we still don't know how large it might need to be. I think the changes I made make sense in that we'd want to process the majority of
the fdt before we do anything w/the initrd.

Quoted 6 lines

Correct me if I am wrong but my understanding is that it will not help if the total size of the blob is too small.

It will just use/allocate free internal blob space - if the internal free space is sufficient. And if it is it can be used at any time. If it is not sufficient, then we need to grow the blob total size first.

At this point in time you are correct. However I'm looking forward to having the possibility of growing things w/regards to the fdt.

- k