All of lore.kernel.org
 help / color / mirror / Atom feed
* master u-boot broken for HiFive Unleashed
@ 2020-07-29 21:43 Atish Patra
  2020-08-03  4:26 ` Bin Meng
  2020-08-04 14:25 ` Pragnesh Patel
  0 siblings, 2 replies; 7+ messages in thread
From: Atish Patra @ 2020-07-29 21:43 UTC (permalink / raw)
  To: u-boot

Hi,
The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
branch '2020-07-28-misc-soc-improvements') seems to be broken for
HiFive Unleashed.

It already has Bin's fix for unleashed.

a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again

dram start and size is corrupted for some reason. I have verified that
it was initialized properly during DT parsing. However, it shows
random values in the U-Boot console.

=> bdinfo
boot_params = 0x0000000000000000
memstart    = 0x0000000000000000
memsize     = 0x00000000
flashstart  = 0x0000000000000000
flashsize   = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate    = 115200 bps
relocaddr   = 0x00000000fff84000
reloc off   = 0x000000007fd84000
Build       = 64-bit

=> bdinfo
boot_params = 0x9a26a361c16aa601
DRAM bank   = 0x0000000000000000
-> start    = 0x974515c3bda965ef
-> size     = 0x79b6f0fb37923036
memstart    = 0x574587c7f00570f9
memsize     = 0xCFD8C0F4D42668AB
flashstart  = 0x67f9fbb06586658b
flashsize   = 0xf91aed913c99b9e1
flashoffset = 0x9ddbf00d69e870fa
baudrate    = 115200 bps

v2020.07 seems to work fine. I couldn't bisect between those two as
the number of commits didn't compile.

-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-07-29 21:43 master u-boot broken for HiFive Unleashed Atish Patra
@ 2020-08-03  4:26 ` Bin Meng
  2020-08-04  1:02   ` Atish Patra
  2020-08-04 14:25 ` Pragnesh Patel
  1 sibling, 1 reply; 7+ messages in thread
From: Bin Meng @ 2020-08-03  4:26 UTC (permalink / raw)
  To: u-boot

Hi Atish,

On Thu, Jul 30, 2020 at 5:43 AM Atish Patra <atishp@atishpatra.org> wrote:
>
> Hi,
> The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
> branch '2020-07-28-misc-soc-improvements') seems to be broken for
> HiFive Unleashed.
>
> It already has Bin's fix for unleashed.
>
> a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
>
> dram start and size is corrupted for some reason. I have verified that
> it was initialized properly during DT parsing. However, it shows
> random values in the U-Boot console.
>
> => bdinfo
> boot_params = 0x0000000000000000
> memstart    = 0x0000000000000000
> memsize     = 0x00000000
> flashstart  = 0x0000000000000000
> flashsize   = 0x0000000000000000
> flashoffset = 0x0000000000000000
> baudrate    = 115200 bps
> relocaddr   = 0x00000000fff84000
> reloc off   = 0x000000007fd84000
> Build       = 64-bit
>
> => bdinfo
> boot_params = 0x9a26a361c16aa601
> DRAM bank   = 0x0000000000000000
> -> start    = 0x974515c3bda965ef
> -> size     = 0x79b6f0fb37923036
> memstart    = 0x574587c7f00570f9
> memsize     = 0xCFD8C0F4D42668AB
> flashstart  = 0x67f9fbb06586658b
> flashsize   = 0xf91aed913c99b9e1
> flashoffset = 0x9ddbf00d69e870fa
> baudrate    = 115200 bps
>
> v2020.07 seems to work fine. I couldn't bisect between those two as
> the number of commits didn't compile.

I cannot reproduce this. See below log:

U-Boot SPL 2020.10-rc1-00172-ga2d051e (Aug 03 2020 - 12:22:07 +0800)
Trying to boot from MMC1


U-Boot 2020.10-rc1-00172-ga2d051e (Aug 03 2020 - 12:22:07 +0800)

CPU:   rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM:  8 GiB
MMC:   spi at 10050000:mmc at 0: 0
Loading Environment from SPIFlash... SF: Detected is25wp256 with page
size 256 Bytes, erase size 4 KiB, total 32 MiB
OK
In:    serial at 10010000
Out:   serial at 10010000
Err:   serial at 10010000
Net:   eth0: ethernet at 10090000
Hit any key to stop autoboot:  0
=>
=> bdinfo
boot_params = 0x0000000000000000
DRAM bank   = 0x0000000000000000
-> start    = 0x0000000080000000
-> size     = 0x0000000200000000
memstart    = 0x0000000000000000
memsize     = 0x00000000
flashstart  = 0x0000000000000000
flashsize   = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate    = 115200 bps
relocaddr   = 0x00000000fff83000
reloc off   = 0x000000007fd83000
Build       = 64-bit
current eth = ethernet at 10090000
ethaddr     = 70:b3:d5:92:f2:51
IP addr     = 128.224.159.129
fdt_blob    = 0x00000000ff75c4a0
new_fdt     = 0x00000000ff75c4a0
fdt_size    = 0x0000000000006980

=>

I built U-Boot from the latest u-boot/master:

commit a2d051e7b6a8f87add1067d936bb0c805a47b0df
Merge: 719f421 db82015
Author: Tom Rini <trini@konsulko.com>
Date:   Fri Jul 31 10:13:07 2020 -0400

    Merge branch '2020-07-31-more-env-updates'

    - Fix EFI selftest to not force setting serial# environment (and also
      get the U-Boot prompt dynamically).
    - Support for append only environment and other related features.
    - Improved ext4 environment support
    - Fix the case of fw_setenv being used on flash devices that were not
      already locked.

Regards,
Bin

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-08-03  4:26 ` Bin Meng
@ 2020-08-04  1:02   ` Atish Patra
  0 siblings, 0 replies; 7+ messages in thread
From: Atish Patra @ 2020-08-04  1:02 UTC (permalink / raw)
  To: u-boot

On Sun, Aug 2, 2020 at 9:26 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Atish,
>
> On Thu, Jul 30, 2020 at 5:43 AM Atish Patra <atishp@atishpatra.org> wrote:
> >
> > Hi,
> > The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
> > branch '2020-07-28-misc-soc-improvements') seems to be broken for
> > HiFive Unleashed.
> >
> > It already has Bin's fix for unleashed.
> >
> > a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
> >
> > dram start and size is corrupted for some reason. I have verified that
> > it was initialized properly during DT parsing. However, it shows
> > random values in the U-Boot console.
> >
> > => bdinfo
> > boot_params = 0x0000000000000000
> > memstart    = 0x0000000000000000
> > memsize     = 0x00000000
> > flashstart  = 0x0000000000000000
> > flashsize   = 0x0000000000000000
> > flashoffset = 0x0000000000000000
> > baudrate    = 115200 bps
> > relocaddr   = 0x00000000fff84000
> > reloc off   = 0x000000007fd84000
> > Build       = 64-bit
> >
> > => bdinfo
> > boot_params = 0x9a26a361c16aa601
> > DRAM bank   = 0x0000000000000000
> > -> start    = 0x974515c3bda965ef
> > -> size     = 0x79b6f0fb37923036
> > memstart    = 0x574587c7f00570f9
> > memsize     = 0xCFD8C0F4D42668AB
> > flashstart  = 0x67f9fbb06586658b
> > flashsize   = 0xf91aed913c99b9e1
> > flashoffset = 0x9ddbf00d69e870fa
> > baudrate    = 115200 bps
> >
> > v2020.07 seems to work fine. I couldn't bisect between those two as
> > the number of commits didn't compile.
>
> I cannot reproduce this. See below log:
>
> U-Boot SPL 2020.10-rc1-00172-ga2d051e (Aug 03 2020 - 12:22:07 +0800)
> Trying to boot from MMC1
>
Thanks for testing.
I was using FSBL. Let me try with U-Boot SPL.

>
> U-Boot 2020.10-rc1-00172-ga2d051e (Aug 03 2020 - 12:22:07 +0800)
>
> CPU:   rv64imafdc
> Model: SiFive HiFive Unleashed A00
> DRAM:  8 GiB
> MMC:   spi at 10050000:mmc at 0: 0
> Loading Environment from SPIFlash... SF: Detected is25wp256 with page
> size 256 Bytes, erase size 4 KiB, total 32 MiB
> OK
> In:    serial at 10010000
> Out:   serial at 10010000
> Err:   serial at 10010000
> Net:   eth0: ethernet at 10090000
> Hit any key to stop autoboot:  0
> =>
> => bdinfo
> boot_params = 0x0000000000000000
> DRAM bank   = 0x0000000000000000
> -> start    = 0x0000000080000000
> -> size     = 0x0000000200000000
> memstart    = 0x0000000000000000
> memsize     = 0x00000000
> flashstart  = 0x0000000000000000
> flashsize   = 0x0000000000000000
> flashoffset = 0x0000000000000000
> baudrate    = 115200 bps
> relocaddr   = 0x00000000fff83000
> reloc off   = 0x000000007fd83000
> Build       = 64-bit
> current eth = ethernet at 10090000
> ethaddr     = 70:b3:d5:92:f2:51
> IP addr     = 128.224.159.129
> fdt_blob    = 0x00000000ff75c4a0
> new_fdt     = 0x00000000ff75c4a0
> fdt_size    = 0x0000000000006980
>
> =>
>
> I built U-Boot from the latest u-boot/master:
>
> commit a2d051e7b6a8f87add1067d936bb0c805a47b0df
> Merge: 719f421 db82015
> Author: Tom Rini <trini@konsulko.com>
> Date:   Fri Jul 31 10:13:07 2020 -0400
>
>     Merge branch '2020-07-31-more-env-updates'
>
>     - Fix EFI selftest to not force setting serial# environment (and also
>       get the U-Boot prompt dynamically).
>     - Support for append only environment and other related features.
>     - Improved ext4 environment support
>     - Fix the case of fw_setenv being used on flash devices that were not
>       already locked.
>
> Regards,
> Bin



-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-07-29 21:43 master u-boot broken for HiFive Unleashed Atish Patra
  2020-08-03  4:26 ` Bin Meng
@ 2020-08-04 14:25 ` Pragnesh Patel
  2020-08-04 14:33   ` Pragnesh Patel
  1 sibling, 1 reply; 7+ messages in thread
From: Pragnesh Patel @ 2020-08-04 14:25 UTC (permalink / raw)
  To: u-boot

Hi Atish,

I tried to debug this and find something interesting.

With FSBL,
I am able to reproduce the same and found that if I will disable CONFIG_OF_BOARD_FIXUP and then print the bdinfo shows expected result.

=> bdinfo
boot_params = 0x0000000000000000
DRAM bank   = 0x0000000000000000
-> start    = 0x0000000080000000
-> size     = 0x0000000200000000
memstart    = 0x0000000000000000
memsize     = 0x00000000
flashstart  = 0x0000000000000000
flashsize   = 0x0000000000000000
flashoffset = 0x0000000000000000
baudrate    = 115200 bps
relocaddr   = 0x00000000fff83000
reloc off   = 0x000000007fd83000
Build       = 64-bit
current eth = ethernet at 10090000
ethaddr     = (not set)
IP addr     = <NULL>
fdt_blob    = 0x00000000ff75e680
new_fdt     = 0x00000000ff75e680
fdt_size    = 0x00000000000047a0
=>

With CONFIG_OF_BOARD_FIXUP, following functions gets called
fix_fdt() ("common/board_f.c") -> board_fix_fdt() ("arch/riscv/lib/fdt_fixup.c") and in this we will increase the fdt_blob size for PMP regions

        /*
         * Extend the FDT by the following estimated size:
         *
         * Each PMP memory region entry occupies 64 bytes.
         * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
         */
        err = fdt_open_into(dst, dst, fdt_totalsize(dst) + 1024);

I suspect this will overwrite the global data (gd) and that creates the problem.


Surprisingly With U-Boot SPL,
Latest U-Boot master branch works fine and shows expected results.

>-----Original Message-----
>From: Atish Patra <atishp@atishpatra.org>
>Sent: 30 July 2020 03:13
>To: U-Boot Mailing List <u-boot@lists.denx.de>; Bin Meng
><bmeng.cn@gmail.com>; Rick Chen <rick@andestech.com>
>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
><lukas.auer@aisec.fraunhofer.de>; Pragnesh Patel <pragnesh.patel@sifive.com>
>Subject: master u-boot broken for HiFive Unleashed
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>Hi,
>The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge branch
>'2020-07-28-misc-soc-improvements') seems to be broken for HiFive Unleashed.
>
>It already has Bin's fix for unleashed.
>
>a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
>
>dram start and size is corrupted for some reason. I have verified that it was
>initialized properly during DT parsing. However, it shows random values in the U-
>Boot console.
>
>=> bdinfo
>boot_params = 0x0000000000000000
>memstart    = 0x0000000000000000
>memsize     = 0x00000000
>flashstart  = 0x0000000000000000
>flashsize   = 0x0000000000000000
>flashoffset = 0x0000000000000000
>baudrate    = 115200 bps
>relocaddr   = 0x00000000fff84000
>reloc off   = 0x000000007fd84000
>Build       = 64-bit
>
>=> bdinfo
>boot_params = 0x9a26a361c16aa601
>DRAM bank   = 0x0000000000000000
>-> start    = 0x974515c3bda965ef
>-> size     = 0x79b6f0fb37923036
>memstart    = 0x574587c7f00570f9
>memsize     = 0xCFD8C0F4D42668AB
>flashstart  = 0x67f9fbb06586658b
>flashsize   = 0xf91aed913c99b9e1
>flashoffset = 0x9ddbf00d69e870fa
>baudrate    = 115200 bps
>
>v2020.07 seems to work fine. I couldn't bisect between those two as the number
>of commits didn't compile.
>
>--
>Regards,
>Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-08-04 14:25 ` Pragnesh Patel
@ 2020-08-04 14:33   ` Pragnesh Patel
  2020-08-05  9:03     ` Pragnesh Patel
  2020-08-09 20:17     ` Atish Patra
  0 siblings, 2 replies; 7+ messages in thread
From: Pragnesh Patel @ 2020-08-04 14:33 UTC (permalink / raw)
  To: u-boot

Hi Atish,

>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Pragnesh Patel
>Sent: 04 August 2020 19:55
>To: Atish Patra <atishp@atishpatra.org>; Bin Meng <bmeng.cn@gmail.com>;
>Rick Chen <rick@andestech.com>
>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
><lukas.auer@aisec.fraunhofer.de>; U-Boot Mailing List <u-boot@lists.denx.de>
>Subject: RE: master u-boot broken for HiFive Unleashed
>
>Hi Atish,
>
>I tried to debug this and find something interesting.
>
>With FSBL,
>I am able to reproduce the same and found that if I will disable
>CONFIG_OF_BOARD_FIXUP and then print the bdinfo shows expected result.
>
>=> bdinfo
>boot_params = 0x0000000000000000
>DRAM bank   = 0x0000000000000000
>-> start    = 0x0000000080000000
>-> size     = 0x0000000200000000
>memstart    = 0x0000000000000000
>memsize     = 0x00000000
>flashstart  = 0x0000000000000000
>flashsize   = 0x0000000000000000
>flashoffset = 0x0000000000000000
>baudrate    = 115200 bps
>relocaddr   = 0x00000000fff83000
>reloc off   = 0x000000007fd83000
>Build       = 64-bit
>current eth = ethernet at 10090000
>ethaddr     = (not set)
>IP addr     = <NULL>
>fdt_blob    = 0x00000000ff75e680
>new_fdt     = 0x00000000ff75e680
>fdt_size    = 0x00000000000047a0
>=>
>
>With CONFIG_OF_BOARD_FIXUP, following functions gets called
>fix_fdt() ("common/board_f.c") -> board_fix_fdt() ("arch/riscv/lib/fdt_fixup.c")
>and in this we will increase the fdt_blob size for PMP regions
>
>        /*
>         * Extend the FDT by the following estimated size:
>         *
>         * Each PMP memory region entry occupies 64 bytes.
>         * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
>         */
>        err = fdt_open_into(dst, dst, fdt_totalsize(dst) + 1024);
>
>I suspect this will overwrite the global data (gd) and that creates the problem.
>
>
>Surprisingly With U-Boot SPL,
>Latest U-Boot master branch works fine and shows expected results.

With U-Boot SPL it works because in riscv_board_reserved_mem_fixup() ("arch/riscv/lib/fdt_fixup.c")

riscv_board_reserved_mem_fixup() {
        /* avoid the copy if we are using the same device tree */
        if (src_fdt_addr == fdt)
                return 0;

	riscv_fdt_copy_resv_mem_node();
}

OpenSBI and U-Boot both are using the same device tree (U-Boot SPL sends U-Boot device tree address in a1 register to OpenSBI), so 
riscv_fdt_copy_resv_mem_node() never gets called.


With FSBL, OpenSBI and U-Boot uses different device tree so riscv_board_reserved_mem_fixup() ("arch/riscv/lib/fdt_fixup.c"), so 
riscv_fdt_copy_resv_mem_node() getting called and tried to increase the fdt_blob size which will overwrite the global data (gd).



>
>>-----Original Message-----
>>From: Atish Patra <atishp@atishpatra.org>
>>Sent: 30 July 2020 03:13
>>To: U-Boot Mailing List <u-boot@lists.denx.de>; Bin Meng
>><bmeng.cn@gmail.com>; Rick Chen <rick@andestech.com>
>>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
>><lukas.auer@aisec.fraunhofer.de>; Pragnesh Patel
>><pragnesh.patel@sifive.com>
>>Subject: master u-boot broken for HiFive Unleashed
>>
>>[External Email] Do not click links or attachments unless you recognize
>>the sender and know the content is safe
>>
>>Hi,
>>The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
>>branch
>>'2020-07-28-misc-soc-improvements') seems to be broken for HiFive
>Unleashed.
>>
>>It already has Bin's fix for unleashed.
>>
>>a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
>>
>>dram start and size is corrupted for some reason. I have verified that
>>it was initialized properly during DT parsing. However, it shows random
>>values in the U- Boot console.
>>
>>=> bdinfo
>>boot_params = 0x0000000000000000
>>memstart    = 0x0000000000000000
>>memsize     = 0x00000000
>>flashstart  = 0x0000000000000000
>>flashsize   = 0x0000000000000000
>>flashoffset = 0x0000000000000000
>>baudrate    = 115200 bps
>>relocaddr   = 0x00000000fff84000
>>reloc off   = 0x000000007fd84000
>>Build       = 64-bit
>>
>>=> bdinfo
>>boot_params = 0x9a26a361c16aa601
>>DRAM bank   = 0x0000000000000000
>>-> start    = 0x974515c3bda965ef
>>-> size     = 0x79b6f0fb37923036
>>memstart    = 0x574587c7f00570f9
>>memsize     = 0xCFD8C0F4D42668AB
>>flashstart  = 0x67f9fbb06586658b
>>flashsize   = 0xf91aed913c99b9e1
>>flashoffset = 0x9ddbf00d69e870fa
>>baudrate    = 115200 bps
>>
>>v2020.07 seems to work fine. I couldn't bisect between those two as the
>>number of commits didn't compile.
>>
>>--
>>Regards,
>>Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-08-04 14:33   ` Pragnesh Patel
@ 2020-08-05  9:03     ` Pragnesh Patel
  2020-08-09 20:17     ` Atish Patra
  1 sibling, 0 replies; 7+ messages in thread
From: Pragnesh Patel @ 2020-08-05  9:03 UTC (permalink / raw)
  To: u-boot

Hi Atish,

I just sent a patch to solve this issue.
https://patchwork.ozlabs.org/project/uboot/patch/20200805090053.11805-1-pragnesh.patel at sifive.com/


Thanks,
Pragnesh

>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Pragnesh Patel
>Sent: 04 August 2020 20:03
>To: Atish Patra <atishp@atishpatra.org>; Bin Meng <bmeng.cn@gmail.com>;
>Rick Chen <rick@andestech.com>
>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
><lukas.auer@aisec.fraunhofer.de>; U-Boot Mailing List <u-boot@lists.denx.de>
>Subject: RE: master u-boot broken for HiFive Unleashed
>
>Hi Atish,
>
>>-----Original Message-----
>>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Pragnesh Patel
>>Sent: 04 August 2020 19:55
>>To: Atish Patra <atishp@atishpatra.org>; Bin Meng <bmeng.cn@gmail.com>;
>>Rick Chen <rick@andestech.com>
>>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
>><lukas.auer@aisec.fraunhofer.de>; U-Boot Mailing List
>><u-boot@lists.denx.de>
>>Subject: RE: master u-boot broken for HiFive Unleashed
>>
>>Hi Atish,
>>
>>I tried to debug this and find something interesting.
>>
>>With FSBL,
>>I am able to reproduce the same and found that if I will disable
>>CONFIG_OF_BOARD_FIXUP and then print the bdinfo shows expected result.
>>
>>=> bdinfo
>>boot_params = 0x0000000000000000
>>DRAM bank   = 0x0000000000000000
>>-> start    = 0x0000000080000000
>>-> size     = 0x0000000200000000
>>memstart    = 0x0000000000000000
>>memsize     = 0x00000000
>>flashstart  = 0x0000000000000000
>>flashsize   = 0x0000000000000000
>>flashoffset = 0x0000000000000000
>>baudrate    = 115200 bps
>>relocaddr   = 0x00000000fff83000
>>reloc off   = 0x000000007fd83000
>>Build       = 64-bit
>>current eth = ethernet at 10090000
>>ethaddr     = (not set)
>>IP addr     = <NULL>
>>fdt_blob    = 0x00000000ff75e680
>>new_fdt     = 0x00000000ff75e680
>>fdt_size    = 0x00000000000047a0
>>=>
>>
>>With CONFIG_OF_BOARD_FIXUP, following functions gets called
>>fix_fdt() ("common/board_f.c") -> board_fix_fdt()
>>("arch/riscv/lib/fdt_fixup.c") and in this we will increase the
>>fdt_blob size for PMP regions
>>
>>        /*
>>         * Extend the FDT by the following estimated size:
>>         *
>>         * Each PMP memory region entry occupies 64 bytes.
>>         * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
>>         */
>>        err = fdt_open_into(dst, dst, fdt_totalsize(dst) + 1024);
>>
>>I suspect this will overwrite the global data (gd) and that creates the problem.
>>
>>
>>Surprisingly With U-Boot SPL,
>>Latest U-Boot master branch works fine and shows expected results.
>
>With U-Boot SPL it works because in riscv_board_reserved_mem_fixup()
>("arch/riscv/lib/fdt_fixup.c")
>
>riscv_board_reserved_mem_fixup() {
>        /* avoid the copy if we are using the same device tree */
>        if (src_fdt_addr == fdt)
>                return 0;
>
>	riscv_fdt_copy_resv_mem_node();
>}
>
>OpenSBI and U-Boot both are using the same device tree (U-Boot SPL sends U-
>Boot device tree address in a1 register to OpenSBI), so
>riscv_fdt_copy_resv_mem_node() never gets called.
>
>
>With FSBL, OpenSBI and U-Boot uses different device tree so
>riscv_board_reserved_mem_fixup() ("arch/riscv/lib/fdt_fixup.c"), so
>riscv_fdt_copy_resv_mem_node() getting called and tried to increase the
>fdt_blob size which will overwrite the global data (gd).
>
>
>
>>
>>>-----Original Message-----
>>>From: Atish Patra <atishp@atishpatra.org>
>>>Sent: 30 July 2020 03:13
>>>To: U-Boot Mailing List <u-boot@lists.denx.de>; Bin Meng
>>><bmeng.cn@gmail.com>; Rick Chen <rick@andestech.com>
>>>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
>>><lukas.auer@aisec.fraunhofer.de>; Pragnesh Patel
>>><pragnesh.patel@sifive.com>
>>>Subject: master u-boot broken for HiFive Unleashed
>>>
>>>[External Email] Do not click links or attachments unless you recognize
>>>the sender and know the content is safe
>>>
>>>Hi,
>>>The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
>>>branch
>>>'2020-07-28-misc-soc-improvements') seems to be broken for HiFive
>>Unleashed.
>>>
>>>It already has Bin's fix for unleashed.
>>>
>>>a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
>>>
>>>dram start and size is corrupted for some reason. I have verified that
>>>it was initialized properly during DT parsing. However, it shows random
>>>values in the U- Boot console.
>>>
>>>=> bdinfo
>>>boot_params = 0x0000000000000000
>>>memstart    = 0x0000000000000000
>>>memsize     = 0x00000000
>>>flashstart  = 0x0000000000000000
>>>flashsize   = 0x0000000000000000
>>>flashoffset = 0x0000000000000000
>>>baudrate    = 115200 bps
>>>relocaddr   = 0x00000000fff84000
>>>reloc off   = 0x000000007fd84000
>>>Build       = 64-bit
>>>
>>>=> bdinfo
>>>boot_params = 0x9a26a361c16aa601
>>>DRAM bank   = 0x0000000000000000
>>>-> start    = 0x974515c3bda965ef
>>>-> size     = 0x79b6f0fb37923036
>>>memstart    = 0x574587c7f00570f9
>>>memsize     = 0xCFD8C0F4D42668AB
>>>flashstart  = 0x67f9fbb06586658b
>>>flashsize   = 0xf91aed913c99b9e1
>>>flashoffset = 0x9ddbf00d69e870fa
>>>baudrate    = 115200 bps
>>>
>>>v2020.07 seems to work fine. I couldn't bisect between those two as the
>>>number of commits didn't compile.
>>>
>>>--
>>>Regards,
>>>Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* master u-boot broken for HiFive Unleashed
  2020-08-04 14:33   ` Pragnesh Patel
  2020-08-05  9:03     ` Pragnesh Patel
@ 2020-08-09 20:17     ` Atish Patra
  1 sibling, 0 replies; 7+ messages in thread
From: Atish Patra @ 2020-08-09 20:17 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 4, 2020 at 7:33 AM Pragnesh Patel <pragnesh.patel@sifive.com> wrote:
>
> Hi Atish,
>
> >-----Original Message-----
> >From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Pragnesh Patel
> >Sent: 04 August 2020 19:55
> >To: Atish Patra <atishp@atishpatra.org>; Bin Meng <bmeng.cn@gmail.com>;
> >Rick Chen <rick@andestech.com>
> >Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
> ><lukas.auer@aisec.fraunhofer.de>; U-Boot Mailing List <u-boot@lists.denx.de>
> >Subject: RE: master u-boot broken for HiFive Unleashed
> >
> >Hi Atish,
> >
> >I tried to debug this and find something interesting.
> >
> >With FSBL,
> >I am able to reproduce the same and found that if I will disable
> >CONFIG_OF_BOARD_FIXUP and then print the bdinfo shows expected result.
> >
> >=> bdinfo
> >boot_params = 0x0000000000000000
> >DRAM bank   = 0x0000000000000000
> >-> start    = 0x0000000080000000
> >-> size     = 0x0000000200000000
> >memstart    = 0x0000000000000000
> >memsize     = 0x00000000
> >flashstart  = 0x0000000000000000
> >flashsize   = 0x0000000000000000
> >flashoffset = 0x0000000000000000
> >baudrate    = 115200 bps
> >relocaddr   = 0x00000000fff83000
> >reloc off   = 0x000000007fd83000
> >Build       = 64-bit
> >current eth = ethernet at 10090000
> >ethaddr     = (not set)
> >IP addr     = <NULL>
> >fdt_blob    = 0x00000000ff75e680
> >new_fdt     = 0x00000000ff75e680
> >fdt_size    = 0x00000000000047a0
> >=>
> >
> >With CONFIG_OF_BOARD_FIXUP, following functions gets called
> >fix_fdt() ("common/board_f.c") -> board_fix_fdt() ("arch/riscv/lib/fdt_fixup.c")
> >and in this we will increase the fdt_blob size for PMP regions
> >
> >        /*
> >         * Extend the FDT by the following estimated size:
> >         *
> >         * Each PMP memory region entry occupies 64 bytes.
> >         * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
> >         */
> >        err = fdt_open_into(dst, dst, fdt_totalsize(dst) + 1024);
> >
> >I suspect this will overwrite the global data (gd) and that creates the problem.
> >
> >
> >Surprisingly With U-Boot SPL,
> >Latest U-Boot master branch works fine and shows expected results.
>
> With U-Boot SPL it works because in riscv_board_reserved_mem_fixup() ("arch/riscv/lib/fdt_fixup.c")
>
> riscv_board_reserved_mem_fixup() {
>         /* avoid the copy if we are using the same device tree */
>         if (src_fdt_addr == fdt)
>                 return 0;
>
>         riscv_fdt_copy_resv_mem_node();
> }
>
> OpenSBI and U-Boot both are using the same device tree (U-Boot SPL sends U-Boot device tree address in a1 register to OpenSBI), so
> riscv_fdt_copy_resv_mem_node() never gets called.
>
>
> With FSBL, OpenSBI and U-Boot uses different device tree so riscv_board_reserved_mem_fixup() ("arch/riscv/lib/fdt_fixup.c"), so
> riscv_fdt_copy_resv_mem_node() getting called and tried to increase the fdt_blob size which will overwrite the global data (gd).
>

Thanks for root causing the issue. Apologies for not replying earlier.

>
>
> >
> >>-----Original Message-----
> >>From: Atish Patra <atishp@atishpatra.org>
> >>Sent: 30 July 2020 03:13
> >>To: U-Boot Mailing List <u-boot@lists.denx.de>; Bin Meng
> >><bmeng.cn@gmail.com>; Rick Chen <rick@andestech.com>
> >>Cc: Anup Patel <anup@brainfault.org>; Lukas Auer
> >><lukas.auer@aisec.fraunhofer.de>; Pragnesh Patel
> >><pragnesh.patel@sifive.com>
> >>Subject: master u-boot broken for HiFive Unleashed
> >>
> >>[External Email] Do not click links or attachments unless you recognize
> >>the sender and know the content is safe
> >>
> >>Hi,
> >>The latest master (423e08cb7701 (origin/master, origin/HEAD) Merge
> >>branch
> >>'2020-07-28-misc-soc-improvements') seems to be broken for HiFive
> >Unleashed.
> >>
> >>It already has Bin's fix for unleashed.
> >>
> >>a0018fc8209c riscv: Make SiFive HiFive Unleashed board boot again
> >>
> >>dram start and size is corrupted for some reason. I have verified that
> >>it was initialized properly during DT parsing. However, it shows random
> >>values in the U- Boot console.
> >>
> >>=> bdinfo
> >>boot_params = 0x0000000000000000
> >>memstart    = 0x0000000000000000
> >>memsize     = 0x00000000
> >>flashstart  = 0x0000000000000000
> >>flashsize   = 0x0000000000000000
> >>flashoffset = 0x0000000000000000
> >>baudrate    = 115200 bps
> >>relocaddr   = 0x00000000fff84000
> >>reloc off   = 0x000000007fd84000
> >>Build       = 64-bit
> >>
> >>=> bdinfo
> >>boot_params = 0x9a26a361c16aa601
> >>DRAM bank   = 0x0000000000000000
> >>-> start    = 0x974515c3bda965ef
> >>-> size     = 0x79b6f0fb37923036
> >>memstart    = 0x574587c7f00570f9
> >>memsize     = 0xCFD8C0F4D42668AB
> >>flashstart  = 0x67f9fbb06586658b
> >>flashsize   = 0xf91aed913c99b9e1
> >>flashoffset = 0x9ddbf00d69e870fa
> >>baudrate    = 115200 bps
> >>
> >>v2020.07 seems to work fine. I couldn't bisect between those two as the
> >>number of commits didn't compile.
> >>
> >>--
> >>Regards,
> >>Atish



-- 
Regards,
Atish

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-09 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 21:43 master u-boot broken for HiFive Unleashed Atish Patra
2020-08-03  4:26 ` Bin Meng
2020-08-04  1:02   ` Atish Patra
2020-08-04 14:25 ` Pragnesh Patel
2020-08-04 14:33   ` Pragnesh Patel
2020-08-05  9:03     ` Pragnesh Patel
2020-08-09 20:17     ` Atish Patra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.