From mboxrd@z Thu Jan 1 00:00:00 1970 From: Auer, Lukas Date: Fri, 2 Aug 2019 10:25:26 +0000 Subject: [U-Boot] [PATCH v2 00/11] SPL support for RISC-V In-Reply-To: References: <20190728155723.3412-1-lukas.auer@aisec.fraunhofer.de> <752D002CFF5D0F4FA35C0100F1D73F3FA40F3AC4@ATCPCS16.andestech.com> <161439c01936ab9b6e3b54c53ca989195227be92.camel@aisec.fraunhofer.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de Hi Rick, On Fri, 2019-08-02 at 14:18 +0530, Anup Patel wrote: > On Fri, Aug 2, 2019 at 2:11 PM Rick Chen wrote: > > Hi Lukas > > > > > Hi Rick, > > > > > > On Thu, 2019-08-01 at 11:32 +0800, Rick Chen wrote: > > > > Hi Lukas > > > > > > > > > > From: Lukas Auer [mailto:lukas.auer at aisec.fraunhofer.de] > > > > > > Sent: Sunday, July 28, 2019 11:57 PM > > > > > > To: u-boot at lists.denx.de > > > > > > Cc: Atish Patra; Rick Jian-Zhi Chen(陳建志); Bin Meng; Sagar Kadam; Alistair > > > > > > Francis; Anup Patel; Troy Benjegerdes; Lukas Auer; Abel Vesa; Alex Kiernan; > > > > > > Alex Marginean; Alexander Graf; Andreas Dannenberg; Andrew F. Davis; Anup > > > > > > Patel; Anup Patel; Atish Patra; Chris Packham; Eugeniu Rosca; Heiko Schocher; > > > > > > Heinrich Schuchardt; Jagan Teki; Jean-Jacques Hiblot; Jens Wiklander; Joe > > > > > > Hershberger; Kever Yang; Lokesh Vutla; Lukasz Majewski; Marek Vasut; Marek > > > > > > Vasut; Marek Vasut; Markus Klotzbuecher; Michal Simek; Paul Burton; Peng > > > > > > Fan; Philipp Tomsich; Philippe Reynes; Ryder Lee; Shawn Guo; Simon Glass; > > > > > > Simon Goldschmidt; Stefan Roese; Stefano Babic; Tien Fong Chee; Vignesh R; > > > > > > Weijie Gao; Ye Li > > > > > > Subject: [PATCH v2 00/11] SPL support for RISC-V > > > > > > > > > > > > This series adds support for SPL to RISC-V U-Boot. Images can be booted via > > > > > > OpenSBI (FW_DYNAMIC firmware) or by directly jumping to them. In the > > > > > > former case, OpenSBI and U-Boot proper are bundled as a FIT image and made > > > > > > available to U-Boot SPL. Currently, only the QEMU board enables U-Boot SPL > > > > > > with a dedicated configuration. It uses RAM as SPL boot device. > > > > > > > > > > > > On many RISC-V CPUs, the device tree is provided to U-Boot by the first stage > > > > > > bootloader. This requires changes to U-Boot SPL (patches 1, > > > > > > 2 and 3), which modify the behavior on other boards as well. > > > > > > > > > > > > To test this series, OpenSBI has to be compiled first. The fw_dynamic.bin > > > > > > binary must be copied into the U-Boot root directory. > > > > > > Alternatively, the location of the binary can be specified with the OPENSBI > > > > > > environment variable. U-Boot can then be build as normal using the > > > > > > configuration qemu-riscv64_spl_defconfig for 64-bit builds or > > > > > > qemu-riscv32_spl_defconfig for 32-bit builds. The outputs from the build > > > > > > process are the U-Boot SPL binary (spl/u-boot-spl.bin) and the U-Boot FIT > > > > > > image (u-boot.itb) containing U-Boot proper and OpenSBI. > > > > > > > > > > > > U-Boot can be run in QEMU with the following command. > > > > > > > > > > > > qemu-system-riscv64 -nographic -machine virt -kernel spl/u-boot-spl \ > > > > > > -device loader,file=u-boot.itb,addr=0x80200000 > > > > > > > > > > > > > > Great job ! > > > > > > > > > > Thank you! > > > > > > > I also try to run the spl flow on ax25-ae350 platform. > > > > But encounter some problems. I am still debugging. > > > > > > > > Following is the error message: > > > > : > > > > U-Boot SPL 2019.07-10574-ge6ef7ec-dirty (Aug 01 2019 - 10:09:45 +0800) > > > > Trying to boot from RAM > > > > > > > > U-Boot 2019.07-10574-ge6ef7ec-dirty (Aug 01 2019 - 10:09:45 +0800) > > > > > > > > DRAM: exception code: 5 , Load access fault , epc 1212654 , ra 1200ffe > > > > ### ERROR ### Please RESET the board ### > > > > > > > > Do you have some comments ? > > > > > > > > > > It is difficult to judge without the exact configuration. Is your > > > current git tree available somewhere? > > > > No, it is not available yet. > > And you don't have the ax25-ae350 board, it is still in vain if the > > git tree is available. > > > > > The error is quite strange, because it already booted U-Boot proper. So > > > the error does not happen in code, which has been directly modified by > > > this series. Perhaps it is trying to initialize something twice (once > > > in SPL and again in U-Boot proper)? Can you check at what location the > > > error occurs? > > > > I found that the exception occurred in get_ram_size() of ax25-ae350.c > > when it try to load the memory address 0x10000. > > But the access of 0x20000 is ok. > > > > I try to mark the get_ram_size() and do not execute it, U-Boot proper > > can boot successfully as below: > > > > U-Boot SPL 2019.07-10574-ge6ef7ec-dirty (Aug 02 2019 - 16:07:54 +0800) > > Trying to boot from RAM > > > > U-Boot 2019.07-10574-ge6ef7ec-dirty (Aug 02 2019 - 16:07:54 +0800) > > DRAM: 1 GiB > > Flash: 64 MiB > > MMC: mmc at f0e00000: 0 > > Loading Environment from SPI Flash... SF: Detected mx25u1635e with > > page size 256 Bytes, erase size 4 KiB, total 2 MiB > > *** Warning - bad CRC, using default environment > > In: serial at f0300000 > > Out: serial at f0300000 > > Err: serial at f0300000 > > Net: no alias for ethernet0 > > Warning: mac at e0100000 (eth0) using random MAC address - 36:13:4d:06:b8:fd > > eth0: mac at e0100000 > > Hit any key to stop autoboot: 0 > > RISC-V # > > > > So I tried to trace openSBI and found the BANNER of openSBI was not printed. > > Is it correct ? > > Yes, U-Boot SPL is passing SBI_SCRATCH_NO_BOOT_PRINTS option to > OpenSBI due to which you don't see any prints. Although, error prints from > OpenSBI will be still available. > If you want to enable the OpenSBI banner, you can remove the option in common/spl/spl_opensbi.c. > > Any idea about why the access of memory address(0x10000) will fail ? > > I guess it seem relative to pmp configuration. > > If it is PMP access checks then you should get ACCESS faults error > prints from OpenSBI. > The access violation you are seeing is strange and I am not sure why OpenSBI does not print any errors. It does seem like a problem with the PMP configuration though. Thanks, Lukas