[PATCH] riscv: Repeat virtio scan

Łukasz Stelmach l.stelmach at samsung.com
Mon Feb 19 13:41:39 CET 2024


The first time virtio_init() gets called from board_init() PCI isn't
ready. Thus any virtio-over-PCI (e.g. network interfaces) devices can't
be detected and used without additional `virtio scan` scan in the shell
or a script.

Signed-off-by: Łukasz Stelmach <l.stelmach at samsung.com>
---
The patch works for my but:

a) maybe virtio_init() should called only from board_init() the same
   way as on ARM?

b) can a repeated virtio_init() break already detected/initialized
   devices?

 board/emulation/qemu-riscv/qemu-riscv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index 181abbbf97d..567b9dc6170 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -46,6 +46,9 @@ int board_late_init(void)
 	if (CONFIG_IS_ENABLED(USB_KEYBOARD))
 		usb_init();
 
+	/* Repeat virtio scan to detect PCI attached virtio devices. */
+	virtio_init();
+
 	return 0;
 }
 
-- 
2.39.2



More information about the U-Boot mailing list