diff mbox series

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

Message ID 20241101134615.3295416-1-romain.naour@smile.fr
State Accepted
Headers show
Series board/qemu/riscv{32, 64}-virt: nommu: needs virtio-blk device | expand

Commit Message

Romain Naour Nov. 1, 2024, 1:46 p.m. UTC
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] dba41736daeaf8065b44427316759e07c35545db
[2] https://gitlab.com/qemu-project/qemu/-/commit/4406ba2b5efce6af64905f827ca244f699db8170

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 board/qemu/riscv32-virt/readme.txt | 2 +-
 board/qemu/riscv64-virt/readme.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Julien Olivain Nov. 1, 2024, 9:21 p.m. UTC | #1
On 01/11/2024 14:46, Romain Naour via buildroot wrote:
> 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] dba41736daeaf8065b44427316759e07c35545db
> [2] 
> https://gitlab.com/qemu-project/qemu/-/commit/4406ba2b5efce6af64905f827ca244f699db8170
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Applied to master. Thanks!

> ---
>  board/qemu/riscv32-virt/readme.txt | 2 +-
>  board/qemu/riscv64-virt/readme.txt | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/board/qemu/riscv32-virt/readme.txt 
> b/board/qemu/riscv32-virt/readme.txt
> index c2ac27121f..b4336e9357 100644
> --- a/board/qemu/riscv32-virt/readme.txt
> +++ b/board/qemu/riscv32-virt/readme.txt
> @@ -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.
> diff --git a/board/qemu/riscv64-virt/readme.txt 
> b/board/qemu/riscv64-virt/readme.txt
> index d7b198842b..f9e920a88b 100644
> --- a/board/qemu/riscv64-virt/readme.txt
> +++ b/board/qemu/riscv64-virt/readme.txt
> @@ -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.
> --
> 2.45.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/board/qemu/riscv32-virt/readme.txt b/board/qemu/riscv32-virt/readme.txt
index c2ac27121f..b4336e9357 100644
--- a/board/qemu/riscv32-virt/readme.txt
+++ b/board/qemu/riscv32-virt/readme.txt
@@ -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.
diff --git a/board/qemu/riscv64-virt/readme.txt b/board/qemu/riscv64-virt/readme.txt
index d7b198842b..f9e920a88b 100644
--- a/board/qemu/riscv64-virt/readme.txt
+++ b/board/qemu/riscv64-virt/readme.txt
@@ -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.