Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

The newer version of dtc stops qemu-system-riscv64 properly executing RustSBI #46

@I-Rinka

Description

@I-Rinka

I'm currently using qemu 7.0.0 for risc-v system emulation. However, the current version of device tree compiler might caught problem. If we use git clone to get the qemu source and compile it, the qemu does not work properly as it gets stuck in a loop before jumping to the kernel. The execution trace of this loop shows below. It causes RustABI in an infinite loop around address 0x80001b00:

(gdb) si
0x0000000080001b00 in ?? ()
(gdb) si
0x0000000080001b04 in ?? ()
(gdb) si
0x0000000080001b08 in ?? ()
(gdb) si
0x0000000080001b0c in ?? ()
(gdb) si
0x0000000080001b10 in ?? ()
(gdb) si
0x0000000080004394 in ?? ()
(gdb) si
0x0000000080001b14 in ?? ()
(gdb) si
0x0000000080001b18 in ?? ()
(gdb) si
0x0000000080001b00 in ?? ()
(gdb) x/10i $pc
=> 0x80001b00:	fence	w,unknown
   0x80001b04:	lb	a0,8(s1)
   0x80001b08:	fence	r,rw
   0x80001b0c:	auipc	ra,0x3
   0x80001b10:	jalr	-1912(ra)
   0x80001b14:	zext.b	a0,a0
   0x80001b18:	blez	a0,0x80001b00
   0x80001b1c:	bne	a0,s0,0x80001b26
   0x80001b20:	fence	w,unknown
   0x80001b24:	j	0x80001b04
(gdb)

I infer this problem is caused by dtc submodule is because if we download source code tar file of qemu 7.0.0 on official website, which include all of the component at that time including the full copy of old version dtc, qemu will work as expected. The only difference between the git clone version and .tar file of qemu 7.0.0 is the submodules (including dtc and a building system). I have tried many kinds of platform and it yields the same result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions