public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Leo Liang <ycliang@andestech.com>
To: "Łukasz Stelmach" <l.stelmach@samsung.com>
Cc: <u-boot@lists.denx.de>, Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] riscv: Repeat virtio scan
Date: Tue, 19 Mar 2024 17:03:32 +0800	[thread overview]
Message-ID: <ZflU5LScAfHSy2K-@swlinux02> (raw)
In-Reply-To: <20240219124139.1541868-1-l.stelmach@samsung.com>

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

      reply	other threads:[~2024-03-19  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZflU5LScAfHSy2K-@swlinux02 \
    --to=ycliang@andestech.com \
    --cc=l.stelmach@samsung.com \
    --cc=m.szyprowski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox