Browse Source

arm: qemu: Enumerate virtio bus during early boot

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>
Bin Meng 6 years ago
parent
commit
b9b5956eb0
2 changed files with 14 additions and 0 deletions
  1. 4 0
      board/emulation/qemu-arm/Kconfig
  2. 10 0
      board/emulation/qemu-arm/qemu-arm.c

+ 4 - 0
board/emulation/qemu-arm/Kconfig

@@ -5,5 +5,9 @@ config SYS_TEXT_BASE
 
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
 	def_bool y
+	imply VIRTIO_MMIO
+	imply VIRTIO_PCI
+	imply VIRTIO_NET
+	imply VIRTIO_BLK
 
 
 endif
 endif

+ 10 - 0
board/emulation/qemu-arm/qemu-arm.c

@@ -2,8 +2,12 @@
 /*
 /*
  * Copyright (c) 2017 Tuomas Tynkkynen
  * Copyright (c) 2017 Tuomas Tynkkynen
  */
  */
+
 #include <common.h>
 #include <common.h>
+#include <dm.h>
 #include <fdtdec.h>
 #include <fdtdec.h>
+#include <virtio_types.h>
+#include <virtio.h>
 
 
 #ifdef CONFIG_ARM64
 #ifdef CONFIG_ARM64
 #include <asm/armv8/mmu.h>
 #include <asm/armv8/mmu.h>
@@ -58,6 +62,12 @@ struct mm_region *mem_map = qemu_arm64_mem_map;
 
 
 int board_init(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;
 	return 0;
 }
 }