-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regression of rv-virt
kernel builds
#12275
Comments
rv-virt
kernel builds are brokken
rv-virt
kernel builds are brokkenrv-virt
kernel builds
rv-virt
kernel buildsrv-virt
kernel builds
@inochisa Any idea why rv-virt:knsh64 crashes on startup? I tested on macOS with QEMU 7.0.0 https://gist.github.com/lupyuen/ce07dd0c21118cebe8e83a8d61439112
|
The RISC-V Exception:
Points to this code:
So CSR_STIMECMP is probably missing. How do we get Opensbi v1.1? Is it in the NuttX Doc? |
@inochisa STIMECMP needs QEMU 7.2 I think? |
For now you can build from source, the newer qemu should ship with possible opensbi. I will write a document for it. Or just disable the SSTC as temporary solution. |
I think you are right. My system is arch and always has newest qemu. So I forgot this issue. Thanks. |
OK lemme upgrade QEMU and retest. If it works, let's update the NuttX Docs for QEMU Version thanks! @yf13 Please try QEMU 7.2 or newer thanks! |
This fixes `rv-virt/knsh64` booting issue apache#12275. Signed-off-by: Yanfeng Liu <[email protected]>
Tested OK on QEMU 7.2.9: https://gist.github.com/lupyuen/b2520054b5ecc12a2f33909aaa46121c @inochisa Could you update the NuttX Doc to say that |
Good, In addition, I will add some comments for users want to use its own OpenSBI. |
This patch can boot `rv-virt/knsh64` reported in issue apache#12275 with qemu 6.2 target in Ubuntu 22.04. Signed-off-by: Yanfeng Liu <[email protected]>
@lupyuen and @inochisa, I sent patch #12279 to disable SSTC as I am using stock QEMU (ver 6.2 with SBI v0.9) on Ubuntu 22.04 most of the time, I believe this is easier for people to start with. However, there is remaining issue even if SSTC is off, the "usleep 5" command doesn't return back to nsh, this indicts that the rv-virt timer related setup logic might be incomplete when SSTC is off? |
I do not think it is a good idea. QEMU for risc-v is always active developed. If we stick on old version, we will lost most of the new features. In addition, 7.2.9 is not too new for most distribution.
This does worth exploring. If SSTC is off, the timer should go the old path. I do not change any old code when adding SSTC, so it is more like another problem |
@inochisa Is it possible that this is causing the Timer Issue with SSTC Disabled? #12178 (comment) Could you help to do a Regression Test based on your patch: If SSTC is Disabled, will |
This is weird, I have tested on my machine. I can confirm rv-virt:knsh64 works on QEMU 9.0.0 without SSTC. PS: with the #12178 patch. |
@inochisa Do you mean that if ARCH_RV_EXT_SSTC=N, then usleep works OK on rv-virt:knsh64? If so, I will test ARCH_RV_EXT_SSTC=N with usleep on my old version of QEMU. Thanks |
Yes.
This worth a try. Thanks. |
@inochisa Sorry https://gist.github.com/lupyuen/749f8235603781c29a351c066cd2fcf9 $ git clone https://github.com/inochisa/nuttx --branch qemu-s-mode
$ git clone https://github.com/apache/nuttx-apps apps
$ cd nuttx && ./tools/configure.sh rv-virt:knsh64
$ make menuconfig
## Disable ARCH_RV_EXT_SSTC
$ grep SSTC .config
$ make
./chip/qemu_rv_start.c:54:4: error: #error "Target requires kernel in S-mode, enable CONFIG_ARCH_USE_S_MODE"
54 | # error "Target requires kernel in S-mode, enable CONFIG_ARCH_USE_S_MODE"
| ^~~~~
ERROR: riscv64-unknown-elf-gcc failed: 1
command: riscv64-unknown-elf-gcc -MT ./qemu_rv_start.o -M '-fno-common' '-Wall' '-Wstrict-prototypes' '-Wshadow' '-Wundef' '-Wno-attributes' '-Wno-unknown-pragmas' '-Wno-psabi' '-Os' '-fno-strict-aliasing' '-fomit-frame-pointer' '-ffunction-sections' '-fdata-sections' '-nostdlib' '-g' '-mcmodel=medany' '-march=rv64imafdc' '-mabi=lp64d' '-isystem' '/private/tmp/qemu-s-mode/nuttx/include' '-D__NuttX__' '-D__KERNEL__' '-pipe' '-I' '/private/tmp/qemu-s-mode/nuttx/arch/risc-v/src/chip' '-I' '/private/tmp/qemu-s-mode/nuttx/arch/risc-v/src/common' '-I' '/private/tmp/qemu-s-mode/nuttx/sched' ./chip/qemu_rv_start.c
make[2]: *** [/private/tmp/qemu-s-mode/nuttx/tools/Config.mk:230: qemu_rv_start.ddc] Error 1
make[1]: *** [Makefile:233: .depend] Error 2
make: *** [tools/Unix.mk:620: pass2dep] Error 2 |
I think you disable CONFIG_ARCH_USE_S_MODE by mistake.... grep should give $ cat .config | grep SSTC
# CONFIG_ARCH_RV_EXT_SSTC is not set |
@inochisa Sorry I goofed. @yf13 Could you update to OpenSBI v1.0? I have a hunch that OpenSBI v0.9 might be buggy, we probably shouldn't use it? Thanks! https://gist.github.com/lupyuen/da195386a4873c572aa26961e4c81d79
|
@lupyuen and @inochisa thanks for all the information! Here I tried So it is good that we finally can support the Ubuntu stock QEMU v6.2 this way: |
Thanks @yf13 ! Moving ahead, we should mandate OpenSBI v1.0 or later. Version 0.9 sounds kinda sus :-) |
This patch can boot `rv-virt/knsh64` and `rv-virt/knsh32` reported in issue apache#12275 with qemu 6.2 target and OpenSBI v1.0 firmware on Ubuntu 22.04 host. Signed-off-by: Yanfeng Liu <[email protected]>
This patch can boot `rv-virt/knsh64` and `rv-virt/knsh32` reported in issue #12275 with qemu 6.2 target and OpenSBI v1.0 firmware on Ubuntu 22.04 host. Signed-off-by: Yanfeng Liu <[email protected]>
@yf13 could you update opensbi to the workable verion: |
On Ubuntu 22.04 with qemu-system-riscv64/32 (version: 6.2+dfsg-2ubuntu6.16) targets and
gcc-riscv64-unknown-elf
toolchain (GCC 10.2) and latest master branch.rv-virt/nsh
andrv-virt/nsh64
can boot.rv-virt/knsh32
andrv-virt/knsh64
can't boot. TheABC
string is invibsile from console.The command line to run nuttx
qemu-system-riscv64 -M virt,aclint=on -semihosting -nographic -bios nuttx
and it has been working well until I pulled latest master. Looks like this booting mode no longer works after patch #12178.By using
qemu-system-riscv64 -M virt,aclint=on -semihosting -nographic -kernel nuttx
to run nuttx with default OpenSBI (v0.9) for rv64, got the exceptionriscv_exception: EXCEPTION: Illegal instruction. MCAUSE: 0000000000000002, EPC: 000000008020902c, MTVAL: 0000000014d79073
.The call stack looks like:
maybe the RV_SSTC extension is unavailable in QEMU 6.2 shipped with Ubuntu 22.04?
Haven't tried
-kernel nuttx
for rv32 as the default firmware seems lacking inqemu-system-data
package on Ubuntu 22.04.The text was updated successfully, but these errors were encountered: