
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@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; }

Hi Łukasz,
On Mon, Feb 19, 2024 at 01:41:39PM +0100, Łukasz Stelmach wrote:
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@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?
A repeated virtio_init() call would not break the already probed devices. But we should prevent this redundancy by moving the virtio_init() call to board_late_init() like what this commit[1] does for ARM.
Could you send a v2 to move the virtio_init() into board_late_init() ?
[1] https://patchwork.ozlabs.org/project/uboot/patch/20201230135712.5289-3-sugho... e1ee06dde7 ("qemu: arm: Initialise virtio devices in board_late_init")
Best regards, Leo
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;
}
participants (2)
-
Leo Liang
-
Łukasz Stelmach