diff mbox series

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

Message ID 1533642246-28302-1-git-send-email-andy.yan@rock-chips.com
State Deferred
Delegated to: Tom Rini
Headers show
Series [U-Boot] image-fdt: reserve lmb for fdt | expand

Commit Message

Andy Yan Aug. 7, 2018, 11:44 a.m. UTC
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(+)

Comments

Andyshrk Aug. 25, 2018, 1:32 a.m. UTC | #1
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
>
Simon Glass Aug. 30, 2018, 12:29 a.m. UTC | #2
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>
Andyshrk Oct. 10, 2018, 6:28 a.m. UTC | #3
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
>
Simon Glass Oct. 11, 2018, 3:13 a.m. UTC | #4
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
diff mbox series

Patch

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);