Skip to content

qemu-system-riscv64: It cannot initialize ramfb video adapter

Host environment

  • Operating system: Ubuntu 22.04.1
  • OS/kernel version: 5.15.0-53-generic
  • Architecture: x86_64
  • QEMU flavor: qemu-riscv64
  • QEMU version: QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.5)
  • QEMU command line:
    qemu-system-riscv64 -machine virt -kernel build/kernel -device ramfb -bios none -serial stdio

Emulated/Virtualized environment

  • Operating system: Bare metal
  • OS/kernel version: Bare metal
  • Architecture: riscv64

Description of problem

It looks like ramfb video adapter doesn't work in riscv64 architecture. But it works fine in aarch64 architecture.

Steps to reproduce

  1. Launch the attached kernel with command:
qemu-system-riscv64 -machine virt -kernel kernel -device ramfb -bios none -serial stdio
  1. You will get the messages in console:
guest fw_cfg dma-interface enabled 
setup ramfb successfull
  1. Video adapter will not initialize. QEMU window will continue display this message:
Guest has not initialized the display (yet).

Additional information

There is a useful project for aarch64 architecture - https://github.com/luickk/qemu-ramfb-aarch64-driver. This is a Bare metal driver for ramfb adapter. It works fine. I adapted it for riscv64 architecture - https://github.com/CityAceE/qemu-ramfb-riscv64-driver. I've successfully went through all problems. Driver compiles now and launches. But unfortunately ramfb doesn't initialize. I parallel traced aarch64 and riscv64. They works equal until initialization. Aarch64 changes revolution just after qemu_cfg_write_entry call, but nothing happened after qemu_cfg_write_entry call in riscv64 emulation. I spent a lot of time trying to resolve this problem, but it looks like a problem in qemu-system-riscv64.

UPDATE

Tested with Windows builds of QEMU:

v 6.1 - The same situation as Ubuntu build 6.2.

v 7.1.92 - Stopped with message:

c:\Program Files\qemu\qemu-system-riscv64.exe: -device ramfb: ramfb device requires fw_cfg with DMA

P.S. v 7.1.92 - qemu-system-aarch64.exe with aarch64 kernel build works fine.

UPDATE2

QEMU emulator version 7.0.0 (v7.0.0-11902-g1d935f4a02-dirty) is the last Windows build which opens my riscv64 kernel without message about requirement of fw_cfg with DMA. Next build "QEMU emulator version 7.0.90 (v7.1.0-rc0-11915-g5f9b281b8a-dirty)" already has this issue.

Edited by Stanislav Yudin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information