starfive-tech / opensbi

Other
17 stars 17 forks source link

switch to upstream OpenSBI #4

Closed pdp7 closed 3 years ago

pdp7 commented 3 years ago

@lbmeng comment in #1:

We should switch to upstream OpenSBI and use the generic platform firmware for BeagleV.

pdp7 commented 3 years ago

@lbmeng do you know if current upstream (https://github.com/riscv/opensbi/commit/54d7def6c254058f9458a0e26205b3c93a48bb42) will run ok on the beta BeagleV Starlight with the StarFive JH7100?

MichaelZhuxx commented 3 years ago

It got stuck after printing DRAM info. in uboot.

OpenSBI v0.9-61-g54d7def
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : sifive,freedom-u74-arty
Platform Features         : mfdeleg
Platform HART Count       : 2
Platform IPI Device       : clint
Platform Timer Device     : clint
Platform Console Device   : uart8250
Platform HSM Device       : ---
Platform SysReset Device  : ---
Firmware Base             : 0x80000000
Firmware Size             : 148 KB
Runtime SBI Version       : 0.3

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01          : 0x0000000080000000-0x000000008003ffff ()
Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000080200000
Domain0 Next Arg1         : 0x0000000082200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART ISA             : rv64imafdcsux
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 36
Boot HART MHPM Count      : 2
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109

U-Boot 2021.04-g7b70e1d44b (May 27 2021 - 20:02:11 +0800)

CPU:   rv64imafdc
DRAM:  8 GiB
lbmeng commented 3 years ago

@MichaelZhuxx Yes, I forgot there is a config change to make it work with upstream OpenSBI. Will send a patch to starfive U-Boot soon.

pdp7 commented 3 years ago

@atishp04 this should be of interest

alistair23 commented 3 years ago

Can you point to the u-boot patch?

pdp7 commented 3 years ago

Can you point to the u-boot patch?

@alistair23 I am not sure if @lbmeng has a public branch, @atishp04 now has: https://github.com/atishp04/u-boot/tree/beagleV/Fedora_VIC_7100_2021.04

@lbmeng did comment in the beta slack that:

I do not have access to hardware right now to validate anything, but I think I removed CONFIG_SIFIVE_CLINT and enabled CONFIG_RISCV_TIMER in the StarFive U-Boot when I tested with upstream OpenSBI the other day. Please have a try.

atishp04 commented 3 years ago

You need the my opensbi branch as well. https://github.com/atishp04/opensbi/tree/beaglev_v1

With these fixes, I am able to boot completely to the userspace with multiple times. OpenSBI branch is based on latest master while U-Boot branch is based on beagleV/Fedora_VIC_7100_2021.04

alistair23 commented 3 years ago

I can get to userspace with mainline OpenSBI as well, but your OpenSBI patch seems pretty important so I'll add that as well.

alistair23 commented 3 years ago

Thanks Atish. OE is now using upstream OpenSBI :)

Will the u-boot patches go upstream or to StarFive?

lbmeng commented 3 years ago

@alistair23 Not sure what U-Boot patch you were using. I plan to send the config patch to StarFive U-Boot. No upstream U-Boot at this point.

lbmeng commented 3 years ago

Closing this as https://github.com/starfive-tech/u-boot/pull/17 is now merged to StarFive U-Boot.

pdp7 commented 3 years ago

instructions on how @mcd500 is building the generic platform and upstream opensbi: https://forum.beagleboard.org/t/new-firmware-boot-hang-is-fixed/29986/4?u=drewfustini