[U-Boot] [PATCH] image-fdt: reserve lmb for fdt

Memory region for fdt should be reserved, or they may be allocated by other module via lmb_alloc. Then the fdt data will be destroy.
We found a case on a board with 64MB DRAM like bellow:
No ethernet found. Hit any key to stop autoboot: 0 ANDROID: reboot reason: "recovery" FDT load addr 0x10f00000 size 41 KiB Booting kernel at 0x2008000 with fdt at 2c8ac00...
lmb_add base:0x58000 size:0x3fa8000 lmb_add base:0x0 size:0x0 lmb_reserve base:0x34ca2a0 size:0xb35d60 Booting Android Image at 0x02008000 ... Kernel load addr 0x02008800 size 3808 KiB RAM disk load addr 0x11000000 size 9000 KiB * fdt: cmdline image address = 0x02c8ac00 Checking for 'FDT'/'FDT Image' at 02c8ac00 * fdt: raw FDT blob Flattened Device Tree blob at 02c8ac00 Booting using the fdt blob at 0x2c8ac00 of_flat_tree at 0x02c8ac00 size 0x00009d6d XIP Kernel Image ... OK do_bootm_states reserve: 0x2008800 -- 0x3b7c30 lmb_reserve base:0x2008800 size:0x3b7c30 no initrd_high env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000) start:360448(0x58000) initrd_high = 0x03fa8000, copy_to_ram = 1 Loading Ramdisk to 02c00000, end 034c9d09 ... OK ERROR: image is not a fdt - must RESET the board to recover. FDT creation failed! hanging...### ERROR ### Please RESET the board ###
Signed-off-by: Andy Yan andy.yan@rock-chips.com ---
common/image-fdt.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/common/image-fdt.c b/common/image-fdt.c index 9b41f16248..56f6d7e26b 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -422,6 +422,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
*of_flat_tree = fdt_blob; *of_size = fdt_totalsize(fdt_blob); + lmb_reserve(&images->lmb, (ulong)*of_flat_tree, *of_size); debug(" of_flat_tree at 0x%08lx size 0x%08lx\n", (ulong)*of_flat_tree, *of_size);

ping
Andy Yan andy.yan@rock-chips.com 于2018年8月7日周二 下午7:43写道:
Memory region for fdt should be reserved, or they may be allocated by other module via lmb_alloc. Then the fdt data will be destroy.
We found a case on a board with 64MB DRAM like bellow:
No ethernet found. Hit any key to stop autoboot: 0 ANDROID: reboot reason: "recovery" FDT load addr 0x10f00000 size 41 KiB Booting kernel at 0x2008000 with fdt at 2c8ac00...
lmb_add base:0x58000 size:0x3fa8000 lmb_add base:0x0 size:0x0 lmb_reserve base:0x34ca2a0 size:0xb35d60 Booting Android Image at 0x02008000 ... Kernel load addr 0x02008800 size 3808 KiB RAM disk load addr 0x11000000 size 9000 KiB
- fdt: cmdline image address = 0x02c8ac00 Checking for 'FDT'/'FDT Image' at 02c8ac00
- fdt: raw FDT blob Flattened Device Tree blob at 02c8ac00 Booting using the fdt blob at 0x2c8ac00 of_flat_tree at 0x02c8ac00 size 0x00009d6d XIP Kernel Image ... OK
do_bootm_states reserve: 0x2008800 -- 0x3b7c30 lmb_reserve base:0x2008800 size:0x3b7c30 no initrd_high env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000) start:360448(0x58000) initrd_high = 0x03fa8000, copy_to_ram = 1 Loading Ramdisk to 02c00000, end 034c9d09 ... OK ERROR: image is not a fdt - must RESET the board to recover. FDT creation failed! hanging...### ERROR ### Please RESET the board ###
Signed-off-by: Andy Yan andy.yan@rock-chips.com
common/image-fdt.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/common/image-fdt.c b/common/image-fdt.c index 9b41f16248..56f6d7e26b 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -422,6 +422,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
*of_flat_tree = fdt_blob; *of_size = fdt_totalsize(fdt_blob);
lmb_reserve(&images->lmb, (ulong)*of_flat_tree, *of_size); debug(" of_flat_tree at 0x%08lx size 0x%08lx\n", (ulong)*of_flat_tree, *of_size);
-- 2.17.1
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On 7 August 2018 at 05:44, Andy Yan andy.yan@rock-chips.com wrote:
Memory region for fdt should be reserved, or they may be allocated by other module via lmb_alloc. Then the fdt data will be destroy.
We found a case on a board with 64MB DRAM like bellow:
No ethernet found. Hit any key to stop autoboot: 0 ANDROID: reboot reason: "recovery" FDT load addr 0x10f00000 size 41 KiB Booting kernel at 0x2008000 with fdt at 2c8ac00...
lmb_add base:0x58000 size:0x3fa8000 lmb_add base:0x0 size:0x0 lmb_reserve base:0x34ca2a0 size:0xb35d60 Booting Android Image at 0x02008000 ... Kernel load addr 0x02008800 size 3808 KiB RAM disk load addr 0x11000000 size 9000 KiB
- fdt: cmdline image address = 0x02c8ac00 Checking for 'FDT'/'FDT Image' at 02c8ac00
- fdt: raw FDT blob Flattened Device Tree blob at 02c8ac00 Booting using the fdt blob at 0x2c8ac00 of_flat_tree at 0x02c8ac00 size 0x00009d6d XIP Kernel Image ... OK
do_bootm_states reserve: 0x2008800 -- 0x3b7c30 lmb_reserve base:0x2008800 size:0x3b7c30 no initrd_high env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000) start:360448(0x58000) initrd_high = 0x03fa8000, copy_to_ram = 1 Loading Ramdisk to 02c00000, end 034c9d09 ... OK ERROR: image is not a fdt - must RESET the board to recover. FDT creation failed! hanging...### ERROR ### Please RESET the board ###
Signed-off-by: Andy Yan andy.yan@rock-chips.com
common/image-fdt.c | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Simon Glass sjg@chromium.org

Hi Simon:
Simon Glass sjg@chromium.org 于2018年8月30日周四 上午8:42写道:
On 7 August 2018 at 05:44, Andy Yan andy.yan@rock-chips.com wrote:
Memory region for fdt should be reserved, or they may be allocated by other module via lmb_alloc. Then the fdt data will be destroy.
We found a case on a board with 64MB DRAM like bellow:
No ethernet found. Hit any key to stop autoboot: 0 ANDROID: reboot reason: "recovery" FDT load addr 0x10f00000 size 41 KiB Booting kernel at 0x2008000 with fdt at 2c8ac00...
lmb_add base:0x58000 size:0x3fa8000 lmb_add base:0x0 size:0x0 lmb_reserve base:0x34ca2a0 size:0xb35d60 Booting Android Image at 0x02008000 ... Kernel load addr 0x02008800 size 3808 KiB RAM disk load addr 0x11000000 size 9000 KiB
- fdt: cmdline image address = 0x02c8ac00 Checking for 'FDT'/'FDT Image' at 02c8ac00
- fdt: raw FDT blob Flattened Device Tree blob at 02c8ac00 Booting using the fdt blob at 0x2c8ac00 of_flat_tree at 0x02c8ac00 size 0x00009d6d XIP Kernel Image ... OK
do_bootm_states reserve: 0x2008800 -- 0x3b7c30 lmb_reserve base:0x2008800 size:0x3b7c30 no initrd_high env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000) start:360448(0x58000) initrd_high = 0x03fa8000, copy_to_ram = 1 Loading Ramdisk to 02c00000, end 034c9d09 ... OK ERROR: image is not a fdt - must RESET the board to recover. FDT creation failed! hanging...### ERROR ### Please RESET the board ###
Signed-off-by: Andy Yan andy.yan@rock-chips.com
common/image-fdt.c | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Simon Glass sjg@chromium.org
Please don't forget to take it, if it okay.
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On 10 October 2018 at 00:28, Andy Yan andyshrk@gmail.com wrote:
Hi Simon:
Simon Glass sjg@chromium.org 于2018年8月30日周四 上午8:42写道:
On 7 August 2018 at 05:44, Andy Yan andy.yan@rock-chips.com wrote:
Memory region for fdt should be reserved, or they may be allocated by other module via lmb_alloc. Then the fdt data will be destroy.
We found a case on a board with 64MB DRAM like bellow:
No ethernet found. Hit any key to stop autoboot: 0 ANDROID: reboot reason: "recovery" FDT load addr 0x10f00000 size 41 KiB Booting kernel at 0x2008000 with fdt at 2c8ac00...
lmb_add base:0x58000 size:0x3fa8000 lmb_add base:0x0 size:0x0 lmb_reserve base:0x34ca2a0 size:0xb35d60 Booting Android Image at 0x02008000 ... Kernel load addr 0x02008800 size 3808 KiB RAM disk load addr 0x11000000 size 9000 KiB
- fdt: cmdline image address = 0x02c8ac00 Checking for 'FDT'/'FDT Image' at 02c8ac00
- fdt: raw FDT blob Flattened Device Tree blob at 02c8ac00 Booting using the fdt blob at 0x2c8ac00 of_flat_tree at 0x02c8ac00 size 0x00009d6d XIP Kernel Image ... OK
do_bootm_states reserve: 0x2008800 -- 0x3b7c30 lmb_reserve base:0x2008800 size:0x3b7c30 no initrd_high env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000) start:360448(0x58000) initrd_high = 0x03fa8000, copy_to_ram = 1 Loading Ramdisk to 02c00000, end 034c9d09 ... OK ERROR: image is not a fdt - must RESET the board to recover. FDT creation failed! hanging...### ERROR ### Please RESET the board ###
Signed-off-by: Andy Yan andy.yan@rock-chips.com
common/image-fdt.c | 1 + 1 file changed, 1 insertion(+)
Reviewed-by: Simon Glass sjg@chromium.org
Please don't forget to take it, if it okay.
Tom, this is assigned to you, will you take it?
Regards, Simon
participants (3)
-
Andy Yan
-
Andy Yan
-
Simon Glass