public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] riscv: Move virtio scan to board_late_init()
       [not found] <CGME20240328095912eucas1p1f064f0460cf71edcfd82ca1782906a44@eucas1p1.samsung.com>
@ 2024-03-28  9:58 ` Łukasz Stelmach
  2024-03-28 11:59   ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Łukasz Stelmach @ 2024-03-28  9:58 UTC (permalink / raw)
  To: u-boot, Leo Liang
  Cc: Marek Szyprowski, Seung-Woo Kim, Jaehoon Chung,
	Łukasz Stelmach

When virtio_init() gets called from board_init() PCI isn't ready. Thus,
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>
---
Changes since v1:
 - remove virtio_init() call from board_init()
 - select BOARD_LATE_INIT for TARGET_QEMU_VIRT

 arch/riscv/Kconfig                      |  1 +
 board/emulation/qemu-riscv/qemu-riscv.c | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index ac52c5e6daf..c5c2e8a9c9d 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -22,6 +22,7 @@ config TARGET_OPENPITON_RISCV64
 
 config TARGET_QEMU_VIRT
 	bool "Support QEMU Virt Board"
+	select BOARD_LATE_INIT
 
 config TARGET_SIFIVE_UNLEASHED
 	bool "Support SiFive Unleashed Board"
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index 181abbbf97d..173245b40e3 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -31,12 +31,6 @@ int is_flash_available(void)
 
 int board_init(void)
 {
-	/*
-	 * Make sure virtio bus is enumerated so that peripherals
-	 * on the virtio bus can be discovered by their drivers
-	 */
-	virtio_init();
-
 	return 0;
 }
 
@@ -46,6 +40,12 @@ int board_late_init(void)
 	if (CONFIG_IS_ENABLED(USB_KEYBOARD))
 		usb_init();
 
+	/*
+	 * Make sure virtio bus is enumerated so that peripherals
+	 * on the virtio bus can be discovered by their drivers
+	 */
+	virtio_init();
+
 	return 0;
 }
 
-- 
2.39.2


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

* Re: [PATCH v2] riscv: Move virtio scan to board_late_init()
  2024-03-28  9:58 ` [PATCH v2] riscv: Move virtio scan to board_late_init() Łukasz Stelmach
@ 2024-03-28 11:59   ` Leo Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2024-03-28 11:59 UTC (permalink / raw)
  To: Łukasz Stelmach
  Cc: u-boot, Marek Szyprowski, Seung-Woo Kim, Jaehoon Chung

On Thu, Mar 28, 2024 at 10:58:24AM +0100, Łukasz Stelmach wrote:
> [EXTERNAL MAIL]
> 
> When virtio_init() gets called from board_init() PCI isn't ready. Thus,
> 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>
> ---
> Changes since v1:
>  - remove virtio_init() call from board_init()
>  - select BOARD_LATE_INIT for TARGET_QEMU_VIRT
> 
>  arch/riscv/Kconfig                      |  1 +
>  board/emulation/qemu-riscv/qemu-riscv.c | 12 ++++++------
>  2 files changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

end of thread, other threads:[~2024-03-28 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240328095912eucas1p1f064f0460cf71edcfd82ca1782906a44@eucas1p1.samsung.com>
2024-03-28  9:58 ` [PATCH v2] riscv: Move virtio scan to board_late_init() Łukasz Stelmach
2024-03-28 11:59   ` Leo Liang

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