diff mbox series

[U-Boot,v3,23/31] arm: qemu: Enumerate virtio bus during early boot

Message ID 1539595287-31378-24-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show
Series virtio: Introduce VirtIO driver support | expand

Commit Message

Bin Meng Oct. 15, 2018, 9:21 a.m. UTC
Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v3: None
Changes in v2:
- imply VIRTIO_PCI for qemu-arm too

 board/emulation/qemu-arm/Kconfig    |  4 ++++
 board/emulation/qemu-arm/qemu-arm.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

Comments

Simon Glass Oct. 24, 2018, 5:31 p.m. UTC | #1
Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v3: None
Changes in v2:
- imply VIRTIO_PCI for qemu-arm too

 board/emulation/qemu-arm/Kconfig    |  4 ++++
 board/emulation/qemu-arm/qemu-arm.c | 10 ++++++++++
 2 files changed, 14 insertions(+)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig
index d1c08c2..02ae4d9 100644
--- a/board/emulation/qemu-arm/Kconfig
+++ b/board/emulation/qemu-arm/Kconfig
@@ -5,5 +5,9 @@  config SYS_TEXT_BASE
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
+	imply VIRTIO_MMIO
+	imply VIRTIO_PCI
+	imply VIRTIO_NET
+	imply VIRTIO_BLK
 
 endif
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 812c906..e1f4709 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -2,8 +2,12 @@ 
 /*
  * Copyright (c) 2017 Tuomas Tynkkynen
  */
+
 #include <common.h>
+#include <dm.h>
 #include <fdtdec.h>
+#include <virtio_types.h>
+#include <virtio.h>
 
 #ifdef CONFIG_ARM64
 #include <asm/armv8/mmu.h>
@@ -58,6 +62,12 @@  struct mm_region *mem_map = qemu_arm64_mem_map;
 
 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;
 }