public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] riscv: Repeat virtio scan
       [not found] <CGME20240219124142eucas1p179abec33d2cf344a2c21cec12f192679@eucas1p1.samsung.com>
@ 2024-02-19 12:41 ` Łukasz Stelmach
  2024-03-19  9:03   ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Stelmach @ 2024-02-19 12:41 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Szyprowski, Łukasz Stelmach

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: Repeat virtio scan
  2024-02-19 12:41 ` [PATCH] riscv: Repeat virtio scan Łukasz Stelmach
@ 2024-03-19  9:03   ` Leo Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2024-03-19  9:03 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: u-boot, Marek Szyprowski

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-sughosh.ganu@linaro.org/
    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;
>  }
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-19  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240219124142eucas1p179abec33d2cf344a2c21cec12f192679@eucas1p1.samsung.com>
2024-02-19 12:41 ` [PATCH] riscv: Repeat virtio scan Łukasz Stelmach
2024-03-19  9:03   ` Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox