diff mbox series

[03/14] qemu: arm: Scan the pci bus in board_init

Message ID 20201126184110.30521-4-sughosh.ganu@linaro.org
State New
Headers show
Series qemu: arm64: Add support for uefi capsule update on qemu arm64 platform | expand

Commit Message

Sughosh Ganu Nov. 26, 2020, 6:40 p.m. UTC
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@linaro.org>

---
 board/emulation/qemu-arm/qemu-arm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.17.1

Comments

Heinrich Schuchardt Dec. 5, 2020, 9:45 a.m. UTC | #1
On 11/26/20 7:40 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@linaro.org>

> ---

>   board/emulation/qemu-arm/qemu-arm.c | 8 ++++++++

>   1 file changed, 8 insertions(+)

>

> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c

> index e146d1cc50..b3d5b3d5c2 100644

> --- a/board/emulation/qemu-arm/qemu-arm.c

> +++ b/board/emulation/qemu-arm/qemu-arm.c

> @@ -65,6 +65,14 @@ 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.

> +	 */

> +	pci_init();


This does not compile if CONFIG_PCI=n.

aarch64-linux-gnu-ld.bfd:
board/emulation/qemu-arm/built-in.o:
in function `board_init':
board/emulation/qemu-arm/qemu-arm.c:74:
undefined reference to `pci_init'

Cf.
arch/arm/mach-mvebu/arm64-common.c-106-#ifdef CONFIG_DM_PCI
board/socrates/socrates.c-134-#if defined(CONFIG_DM_PCI)

I found these lines in common/board_r.c:250

#ifdef CONFIG_PCI
static int initr_pci(void)
{
         if (IS_ENABLED(CONFIG_PCI_INIT_R))
                 pci_init();

         return 0;
}
#endif

Would selecting CONFIG_PCI_INIT_R be enough to solve your problem?

Best regards

Heinrich

> +

>   	/*

>   	 * Make sure virtio bus is enumerated so that peripherals

>   	 * on the virtio bus can be discovered by their drivers

>
Sughosh Ganu Dec. 7, 2020, 5:16 a.m. UTC | #2
On Sat, 5 Dec 2020 at 15:15, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:

> On 11/26/20 7:40 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@linaro.org>

> > ---

> >   board/emulation/qemu-arm/qemu-arm.c | 8 ++++++++

> >   1 file changed, 8 insertions(+)

> >

> > diff --git a/board/emulation/qemu-arm/qemu-arm.c

> b/board/emulation/qemu-arm/qemu-arm.c

> > index e146d1cc50..b3d5b3d5c2 100644

> > --- a/board/emulation/qemu-arm/qemu-arm.c

> > +++ b/board/emulation/qemu-arm/qemu-arm.c

> > @@ -65,6 +65,14 @@ 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.

> > +      */

> > +     pci_init();

>

> This does not compile if CONFIG_PCI=n.

>

> aarch64-linux-gnu-ld.bfd:

> board/emulation/qemu-arm/built-in.o:

> in function `board_init':

> board/emulation/qemu-arm/qemu-arm.c:74:

> undefined reference to `pci_init'

>

> Cf.

> arch/arm/mach-mvebu/arm64-common.c-106-#ifdef CONFIG_DM_PCI

> board/socrates/socrates.c-134-#if defined(CONFIG_DM_PCI)

>

> I found these lines in common/board_r.c:250

>

> #ifdef CONFIG_PCI

> static int initr_pci(void)

> {

>          if (IS_ENABLED(CONFIG_PCI_INIT_R))

>                  pci_init();

>

>          return 0;

> }

> #endif

>

> Would selecting CONFIG_PCI_INIT_R be enough to solve your problem?

>


Will check this out. Thanks.

-sughosh
diff mbox series

Patch

diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index e146d1cc50..b3d5b3d5c2 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -65,6 +65,14 @@  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.
+	 */
+	pci_init();
+
 	/*
 	 * Make sure virtio bus is enumerated so that peripherals
 	 * on the virtio bus can be discovered by their drivers