Page MenuHomeFreeBSD

sysutils/opensbi: update to v0.9
ClosedPublic

Authored by mhorne on Feb 3 2021, 4:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 5, 6:20 PM
Unknown Object (File)
Sat, Nov 26, 3:38 PM

Details

Summary

This change adds a patch to disable the PMP for the sifive/fu540 target,
which is a workaround to a PMP errata in the chip. The OpenSBI update
itself is quite minor.

Bump the dependent port, sysutils/u-boot-sifive-fu540.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne requested review of this revision.Feb 3 2021, 4:39 PM

LGTM for the port format.

This revision is now accepted and ready to land.Feb 3 2021, 4:42 PM

@maciphone2_googlemail.com this is the same workaround I sent to you last week. Would you mind giving it another test with this version of the ports? Thanks.

sysutils/opensbi/files/patch-lib_sbi_sbi__hart.c
12 ↗(On Diff #83319)

I wanted this to be a compile-time check, but unfortunately could not find a clean way to rebuild this file for both opensbi targets.

Workaround looks correct.

FreeBSD freebsd 13.0-CURRENT FreeBSD 13.0-CURRENT #1 main-c255394-gf20c0e33195: Mon Dec 28 14:14:50 UTC 2020     root@freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  amd64
-
root@freebsd:/usr/ports # patch < D28471.patch
root@freebsd:/usr/local/share/u-boot/u-boot-sifive-fu540 # ls /usr/ports/sysutils/opensbi/files
patch-Makefile
patch-Makefile.orig
patch-Makefile.rej
patch-lib_sbi_sbi__hart.c
patch-lib_sbi_sbi__hart.c.orig
patch-platform_generic_platform.c
patch-platform_generic_platform.c.orig
patch-platform_sifive_fu540_platform.c
patch-platform_sifive_fu540_platform.c.orig
root@freebsd:/usr/local/share/u-boot/u-boot-sifive-fu540 # 

root@freebsd:/usr/ports/sysutils/u-boot-sifive-fu540 # make deinstall reinstall
....

root@freebsd:/usr/local/share/u-boot/u-boot-sifive-fu540 # sgdisk --clear --set-alignment=2 \
?     --new=1:34:2081 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \
?     --new=2:2082:10273 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \
?     /dev/da2

--

U-Boot SPL 2020.10 (Feb 03 2021 - 20:49:03 +0000)
Trying to boot from MMC1
x0000000200001800
sbi_trap_error: hart0: ra=0x00000000800004b6 sp=0x000000008001bf30
sbi_trap_error: hart0: gp=0x0000000000000000 tp=0x000000008001c000
sbi_trap_err

U-Boot 2020.10 (Feb 03 2021 - 20:49:03 +0000)

CPU:   rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM:  0275fd0
sbi_trap_e8 GiB
art0: a2=0x0000000085000008 a3=0x0000000000000000
sbi_trap_error: hart0: a4=0x0000000080000520 a5=0x000000000000007f
sbi_trap_error: hart0: a6=0x0000000000000000 a7=0x0000000000000000
sbi_trap_error: hart0: s2=0x000000008001c000 s3=0x0000000000000000
sbi_trap_error: hart0: s4=0x0000000000000000 s5=0x0000000000000000
sbi_trap_error: hart0: s6=0xffffffffffffffff s7=0x0000000000000004
???ł???????????ł???????j?????j??b???????*?٥ɽ????с2ɽ???A%??͡?rr??????????????e?"Uѕ?ѕ??J?ɪ??ɪ???ѡ????????镁????ѕͱ*Ʌ͕???镁?Z?	???х????j?	5R?????????????j?4??}?Ʌ?}??ɽ??B?????????????????????????????????????????????j?4??}?Ʌ?}??ɽ??B?????????????????????????j??OK
In:    serial@10010000
Out:   serial@10010000
Err:   serial@10010000
Net:   eth0: ethernet@10090000
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
** Unrecognized filesystem type **
SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
device 0 offset 0x1fff000, size 0x1000
SF: 4096 bytes @ 0x1fff000 Read: OK
## Executing script at 88100000
Wrong image format for "source" command
SCRIPT FAILED: continuing...
ethernet@10090000: PHY present at 0
ethernet@10090000: Starting autonegotiation...
ethernet@10090000: Autonegotiation complete
ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3c00)
BOOTP broadcast 1
DHCP client bound to address 192.168.1.3 (3 ms)
Using ethernet@10090000 device
TFTP from server 192.168.1.117; our IP address is 192.168.1.3
Filename 'boot.scr.uimg'.
Load address: 0x88100000
Loading: *
TFTP error: 'File not found' (1)
Not retrying...
ethernet@10090000: PHY present at 0
ethernet@10090000: Starting autonegotiation...
ethernet@10090000: Autonegotiation complete
ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3c00)
BOOTP broadcast 1
DHCP client bound to address 192.168.1.3 (2 ms)
Using ethernet@10090000 device
TFTP from server 192.168.1.117; our IP address is 192.168.1.3
Filename 'boot/loader.efi'.
Load address: 0x84000000
Loading: #################################################################
	 ################################
	 10.6 MiB/s
done
Bytes transferred = 1415772 (159a5c hex)
...
...
...
root@:~ # uname -a
FreeBSD  13.0-ALPHA1 FreeBSD 13.0-ALPHA1 #4 5bd565855a9: Thu Jan 21 13:53:57 UTC 2021     root@freebsd:/usr/obj/usr/riscv-src/freebsd-src/riscv.riscv64/sys/GENERIC-NODEBUG  riscv

thanks !

---edit :- --
well, compared to your Jan 21 2021-patch : https://dmesgd.nycbug.org/index.cgi?do=view&id=5888 , the OpenSBI-logo isn't displayed on boot and DRAM report differs on boot :

U-Boot 2020.10 (Feb 03 2021 - 20:49:03 +0000)

CPU:   rv64imafdc
Model: SiFive HiFive Unleashed A00
DRAM:  0275fd0
sbi_trap_e8 GiB
  • I don't see a problem with this patch in RAM-detection :
root@:~ # sysctl hw
hw.machine: riscv
hw.ncpu: 4
hw.byteorder: 1234
hw.physmem: 8579952640
hw.usermem: 8506937344
hw.pagesize: 4096
hw.machine_arch: riscv64
hw.realmem: 8589934592

..
thanks again for good work !

This revision was automatically updated to reflect the committed changes.