openhwgroup / cva6-sdk

CVA6 SDK containing RISC-V tools and Buildroot
59 stars 64 forks source link

Issue booting Linux on Ariane w/o FPU #58

Closed kyaso closed 2 years ago

kyaso commented 2 years ago

Hello, we are trying to boot Linux on an Ariane without an FPU.

The FPU support is disabled inside the kernel config, and floating-point operations are disabled inside the Buildroot-config, as well. In the device tree, we use riscv,isa = "rv64imac";.

From the error message (see below), it looks like the init process still executes a floating-point operation (instruction b920 = fsd fs0,112(a0)), which leads to a Kernel panic.

Can you help us with this?

[   28.485443] Key type dns_resolver registered
[   28.524017] Freeing unused kernel memory: 180K
[   28.529907] Run /init as init process
[   28.565002] init[1]: unhandled signal 4 code 0x1 at 0x0000003fde1bdc50 in ld-2.32.so[3fde1ac000+18000]
[   28.572021] CPU: 0 PID: 1 Comm: init Not tainted 5.10.7 #3
[   28.576141] epc: 0000003fde1bdc50 ra : 0000003fde1bcd06 sp : 0000003ffff06370
[   28.584259]  gp : ffffffe0012aeb20 tp : 0000000000000000 t0 : 0000000400000006
[   28.591278]  t1 : 0000003fde1acd6c t2 : 000000006ffffeff s0 : 0000003ffff06a80
[   28.597747]  s1 : 0000003fde1c7130 a0 : 0000003ffff063a8 a1 : 0000000000000000
[   28.605041]  a2 : 0000003ffff065d8 a3 : 0000000000000000 a4 : 0000000000000024
[   28.613037]  a5 : 0000003ffff06398 a6 : 7efefefefefefeff a7 : 4d4824170a4b570a
[   28.620239]  s2 : 0000002ab172ecd8 s3 : 0000002ab17cfdc0 s4 : 0000003fde1c71a0
[   28.626739]  s5 : 0000003fde1c71a0 s6 : 0000000000000000 s7 : 0000000000000000
[   28.634704]  s8 : 0000000000000000 s9 : 0000000000000001 s10: 0000003ffff065c0
[   28.641937]  s11: 0000003ffff065d8 t3 : 0000003fde1bccd6 t4 : 00000078756e694c
[   28.649169]  t5 : 0000003fde1aa368 t6 : 756e694c00000000
[   28.653808] status: 0000000200000020 badaddr: 000000000000b920 cause: 0000000000000002
[   28.664978] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
[   28.669586] CPU: 0 PID: 1 Comm: init Not tainted 5.10.7 #3
[   28.674835] Call Trace:
[   28.677581] [<ffffffe000202172>] walk_stackframe+0x0/0xa6
[   28.682922] [<ffffffe00063afea>] show_stack+0x32/0x3e
[   28.688018] [<ffffffe00063d67c>] dump_stack+0x74/0x8e
[   28.693023] [<ffffffe00063b1cc>] panic+0xf2/0x290
[   28.697723] [<ffffffe00020a536>] do_exit+0x684/0x6f2
[   28.702728] [<ffffffe00020b274>] do_group_exit+0x2a/0x7a
[   28.708068] [<ffffffe000213918>] get_signal+0x114/0x682
[   28.713287] [<ffffffe000201a2e>] do_notify_resume+0x78/0x2a2
[   28.718963] [<ffffffe0002012ae>] ret_from_exception+0x0/0xc
[   28.724853] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]---
kyaso commented 2 years ago

We were able to fix our issue.

Problem was, that one has to do a full rebuild of Buildroot, whenever the floating-point options are modified in the config (source).

We didn't do that, so our Busybox was still compiled with FPU instructions, causing the error in init.

Related issue: https://github.com/riscv-software-src/riscv-pk/issues/166

bchetwynd commented 2 years ago

@kyaso - I have the exact same issue. Can you share the steps you went through to ensure FPU support was disabled in the Kernel and Busybox?

kyaso commented 2 years ago

@bchetwynd Sorry for the late response.

As far as I can recall, you need to enforce a full rebuild. Cleaning all existing build artifacts should do the job, I guess. Unfortunately, I don't have access to the same steps, as it's been some time and I'm also not with that company anymore.

Hope this helps.