[PATCH] qemu: arm: Scan the pci bus in board_init

Bin Meng bmeng.cn at gmail.com
Tue Dec 31 16:38:03 CET 2019


On Tue, Dec 31, 2019 at 11:18 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> CC Bin Meng
>
> On 12/31/19 4:08 PM, Heinrich Schuchardt wrote:
> > On 12/31/19 2:31 PM, Sughosh Ganu wrote:
> >> Scan the pci bus in board_init routine before scanning the virtio
> >> devices. This enumerates all the virtio devices, including devices
> >> found on the pci bus.
> >>
> >> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> >> ---
> >>  board/emulation/qemu-arm/qemu-arm.c | 7 +++++++
> >>  1 file changed, 7 insertions(+)
> >>
> >> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> >> index 4e18733..6c5335c 100644
> >> --- a/board/emulation/qemu-arm/qemu-arm.c
> >> +++ b/board/emulation/qemu-arm/qemu-arm.c
> >> @@ -63,6 +63,13 @@ struct mm_region *mem_map = qemu_arm64_mem_map;
> >>  int board_init(void)
> >>  {
> >>      /*
> >> +     * Scan the pci bus before calling virtio_init. This
> >> +     * enumerates all virtio devices, including devices
> >> +     * on the pci bus.
> >
> > The last sentence is easy to misunderstand. You surely do not mean that
> > pci_init() would enumerate all virtio devices including mmio virtio devices.
> >
> > I would suggest to rephrase it to "This enumerates all pci devices
> > including virtio devices on the pci bus."

Sounds good.

> >
> > With the patch I no longer need to run `virtio scan` on
> > qemu_arm64_defonfig before using the rng command supplied in patch
> >
> > [PATCH 1/1] cmd: add rng command
> > https://lists.denx.de/pipermail/u-boot/2019-December/394539.html
> >
> > Unfortunately you only considered the ARM architecture. We need a
> > solution that works on all QEMU architectures (MIPS, RISC-V, X86, ARM).
> >

Agreed, sorry I missed that. Actually all the board_init() look
similar so we should do the same.

> > How about eliminating board_init() for ARM and RISC-V and moving
> > virtio_init() to common/board_r.c after initr_pci?
> >

Or maybe we introduce a new driver model flag so that uclass drivers
are automatically probed?

Regards,
Bin


More information about the U-Boot mailing list