board/qemu/riscv{32, 64}-virt: nommu: needs virtio-blk device

Commit [1] removed virtio-blk-device,drive=hd0 from the Qemu command
line since RISC-V virt target now define a default type for block
devices (virtio) [2].

While it's was working as expected using
qemu_riscv{32,64}_virt_defconfig, it doesn't work for nommu variant.

Without "-device virtio-blk-device,drive=hd0", the virtio block device
virtio0 is missing in dmesg:

Expected dmesg log:

  virtio_blk virtio0: 1/0/0 default/read/poll queues
  virtio_blk virtio0: [vda] 122880 512-byte logical blocks (62.9 MB/60.0 MiB)

Unlike qemu_riscv{32,64}_virt_defconfig, mmu variant doesn't use
opensbi (-bios none) and disable mmu (-cpu rv{32,64},mmu=off)
from the qemu command line...

Adding back "-device virtio-blk-device,drive=hd0" seems to help Qemu
to enable the virtio block device for nommu target.

This partially revert commit [1].

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/8233227503 (qemu_riscv32_nommu_virt_defconfig)
https://gitlab.com/buildroot.org/buildroot/-/jobs/8233227509 (qemu_riscv64_nommu_virt_defconfig)

[1] dba41736da
[2] 4406ba2b5e

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Romain Naour 2024-11-01 14:46:15 +01:00 committed by Julien Olivain
parent 9534b9c00c
commit e7cd3741b5
2 changed files with 2 additions and 2 deletions

View File

@ -2,6 +2,6 @@ Run Linux in emulation with:
qemu-system-riscv32 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv32_virt_defconfig
qemu-system-riscv32 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw -nographic -cpu rv32,mmu=off -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 # qemu_riscv32_nommu_virt_defconfig
qemu-system-riscv32 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -nographic -cpu rv32,mmu=off -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 # qemu_riscv32_nommu_virt_defconfig
The login prompt will appear in the terminal that started Qemu.

View File

@ -2,6 +2,6 @@ Run Linux in emulation with:
qemu-system-riscv64 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv64_virt_defconfig
qemu-system-riscv64 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw -nographic -cpu rv64,mmu=off -netdev user,id=net0 -device virtio-net-device,netdev=net0 # qemu_riscv64_nommu_virt_defconfig
qemu-system-riscv64 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -nographic -cpu rv64,mmu=off -netdev user,id=net0 -device virtio-net-device,netdev=net0 # qemu_riscv64_nommu_virt_defconfig
The login prompt will appear in the terminal that started Qemu.