qemu: arm: Scan the pci bus in board_init
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
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.
--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)
board/emulation/qemu-arm/qemu-arm.c +7 -0
@@ -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. +*/ +pci_init (); + +/* * Make sure virtio bus is enumerated so that peripherals * on the virtio bus can be discovered by their drivers */
Signature · 1 line
2.7.4
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
Quoted 10 lines · Sughosh Ganu
Scan the pci bus in
board_initroutine before scanning the virtio devices. This enumerates all the virtio devices, including devices found on the pci bus.Signed-off-by Sughosh Ganu <[email protected]>--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
In reply to Sughosh GanuQuoted 14 lines · Sughosh Ganu
Scan the pci bus in
board_initroutine before scanning the virtio devices. This enumerates all the virtio devices, including devices found on the pci bus.Signed-off-by Sughosh Ganu <[email protected]>--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)board/emulation/qemu-arm/qemu-arm.c +0
-0
board/emulation/qemu-arm/qemu-arm.c struct mm_region *mem_map = qemu_arm64_mem_map; · line 68
Quoted 6 lines
board/emulation/qemu-arm/qemu-arm.c +3
-0@@ -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."
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).
How about eliminating board_init() for ARM and RISC-V and moving virtio_init() to common/board_r.c after initr_pci?
Best regards
Heinrich
Quoted 8 lines
board/emulation/qemu-arm/qemu-arm.c +4
-0+*/ +pci_init (); + +/* * Make sure virtio bus is enumerated so that peripherals * on the virtio bus can be discovered by their drivers */
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
CC Bin Meng
Quoted 54 lines · Heinrich Schuchardt
Quoted 14 lines · Sughosh Ganu
Scan the pci bus in
board_initroutine before scanning the virtio devices. This enumerates all the virtio devices, including devices found on the pci bus.Signed-off-by Sughosh Ganu <[email protected]>--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)board/emulation/qemu-arm/qemu-arm.c +0
-0board/emulation/qemu-arm/qemu-arm.c struct mm_region *mem_map = qemu_arm64_mem_map; · line 68
Quoted 6 lines
board/emulation/qemu-arm/qemu-arm.c +3
-0@@ -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."
With the patch I no longer need to run
virtio scanonqemu_arm64_defonfigbefore using the rng command supplied in patch[PATCH 1/1] cmd: add rng command
https://lists.denx.de/pipermail/u-boot/2019-December/394539.htmlUnfortunately you only considered the ARM architecture. We need a solution that works on all QEMU architectures (MIPS, RISC-V, X86, ARM).
How about eliminating
board_init()for ARM and RISC-V and movingvirtio_init()tocommon/board_r.cafterinitr_pci?Best regards
Heinrich
Quoted 8 lines
board/emulation/qemu-arm/qemu-arm.c +4
-0+*/ +pci_init (); + +/* * Make sure virtio bus is enumerated so that peripherals * on the virtio bus can be discovered by their drivers */
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
Quoted 31 lines · Heinrich Schuchardt
CC Bin Meng
Quoted 27 lines · Heinrich Schuchardt
Quoted 14 lines · Sughosh Ganu
Scan the pci bus in
board_initroutine before scanning the virtio devices. This enumerates all the virtio devices, including devices found on the pci bus.Signed-off-by Sughosh Ganu <[email protected]>--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)board/emulation/qemu-arm/qemu-arm.c +0
-0board/emulation/qemu-arm/qemu-arm.c struct mm_region *mem_map = qemu_arm64_mem_map; · line 68
Quoted 6 lines
board/emulation/qemu-arm/qemu-arm.c +3
-0@@ -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.
Quoted 10 lines
Quoted 10 lines
With the patch I no longer need to run
virtio scanonqemu_arm64_defonfigbefore using the rng command supplied in patch[PATCH 1/1] cmd: add rng command
https://lists.denx.de/pipermail/u-boot/2019-December/394539.htmlUnfortunately 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.
Quoted 3 lines
Quoted 3 lines
How about eliminating
board_init()for ARM and RISC-V and movingvirtio_init()tocommon/board_r.cafterinitr_pci?
Or maybe we introduce a new driver model flag so that uclass drivers are automatically probed?
Regards,
Bin
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
In reply to Heinrich SchuchardtQuoted 27 lines · Heinrich Schuchardt
Review
Quoted 10 lines · Sughosh Ganu
Scan the pci bus in
board_initroutine before scanning the virtio devices. This enumerates all the virtio devices, including devices found on the pci bus.Signed-off-by Sughosh Ganu <[email protected]>--- board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0
b/board/emulation/qemu-arm/qemu-arm.cboard/emulation/qemu-arm/qemu-arm.c struct mm_region *mem_map = qemu_arm64_mem_map; · line 68
Quoted 10 lines
index 4e18733..6c5335c 100644
board/emulation/qemu-arm/qemu-arm.c +3
-0@@ -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.
Quoted 3 lines
I would suggest to rephrase it to "This enumerates all pci devices including virtio devices on the pci bus."
Ok.
Quoted 10 lines
With the patch I no longer need to run
virtio scanonqemu_arm64_defonfigbefore using the rng command supplied in patch[PATCH 1/1] cmd: add rng command
https://lists.denx.de/pipermail/u-boot/2019-December/394539.htmlUnfortunately you only considered the ARM architecture. We need a solution that works on all QEMU architectures (MIPS, RISC-V, X86, ARM).
That is fine with me, but currently, only risc-v and arm architectures are calling virtio_init.
Quoted 4 lines
How about eliminating
board_init()for ARM and RISC-V and movingvirtio_init()tocommon/board_r.cafterinitr_pci?
That can be done, but currently, for some reason, initr_pci function calls pci_init only when CONFIG_DM_PCI is not defined. Not sure why that is the case, although initr_pci gets called after initr_dm.
-sughosh
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
Quoted 57 lines · Sughosh Ganu
On Tue, 31 Dec 2019 at 20:38, Heinrich Schuchardt <[email protected] <mailto:[email protected]>> wrote:
On 12/31/19 2:31 PM, Sughosh Ganu wrote:
> Scan the pci bus inboard_initroutine before scanning the virtio > devices. This enumerates all the virtio devices, including devices > found on the pci bus.
>
> Signed-off-by: Sughosh Ganu <[email protected]
<mailto:[email protected]>>
> ---
>board/emulation/qemu-arm/qemu-arm.c| 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --gita/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 @@ structmm_region*mem_map=qemu_arm64_mem_map; > intboard_init(void)
> {
> /*
> + * Scan the pci bus before callingvirtio_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."
Ok.
With the patch I no longer need to run
virtio scanonqemu_arm64_defonfigbefore using the rng command supplied in patch[PATCH 1/1] cmd: add rng command
https://lists.denx.de/pipermail/u-boot/2019-December/394539.htmlUnfortunately you only considered the ARM architecture. We need a solution that works on all QEMU architectures (MIPS, RISC-V, X86, ARM).
That is fine with me, but currently, only risc-v and arm architectures are calling
virtio_init.How about eliminating
board_init()for ARM and RISC-V and movingvirtio_init()tocommon/board_r.cafterinitr_pci?
Quoted 5 lines
That can be done, but currently, for some reason,
initr_pcifunction callspci_initonly whenCONFIG_DM_PCIis not defined. Not sure why that is the case, althoughinitr_pcigets called afterinitr_dm.-sughosh
This dates back to Simon's commit ff3e077bd23c ("dm: pci: Add a uclass for PCI").
I hope that Simon can tell us why he chose not to call pci_init() if DM_PCI is defined.
Best regards
Heinrich
PATCH 1/1 qemu: arm: Scan the pci bus in board_init
Hi Heinrich,
Quoted 63 lines · Heinrich Schuchardt
Quoted 61 lines · Sughosh Ganu
On Tue, 31 Dec 2019 at 20:38, Heinrich Schuchardt <[email protected] <mailto:[email protected]>> wrote:
On 12/31/19 2:31 PM, Sughosh Ganu wrote:
> Scan the pci bus inboard_initroutine before scanning the virtio > devices. This enumerates all the virtio devices, including devices > found on the pci bus.
>
> Signed-off-by: Sughosh Ganu <[email protected]
<mailto:[email protected]>>
> ---
>board/emulation/qemu-arm/qemu-arm.c| 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --gita/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 @@ structmm_region*mem_map=qemu_arm64_mem_map; > intboard_init(void)
> {
> /*
> + * Scan the pci bus before callingvirtio_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."
Ok.
With the patch I no longer need to run
virtio scanonqemu_arm64_defonfigbefore using the rng command supplied in patch[PATCH 1/1] cmd: add rng command
https://lists.denx.de/pipermail/u-boot/2019-December/394539.htmlUnfortunately you only considered the ARM architecture. We need a solution that works on all QEMU architectures (MIPS, RISC-V, X86, ARM).
That is fine with me, but currently, only risc-v and arm architectures are calling
virtio_init.How about eliminating
board_init()for ARM and RISC-V and movingvirtio_init()tocommon/board_r.cafterinitr_pci?That can be done, but currently, for some reason,
initr_pcifunction callspci_initonly whenCONFIG_DM_PCIis not defined. Not sure why that is the case, althoughinitr_pcigets called afterinitr_dm.
Quoted 7 lines
Quoted 1 line
-sughosh
This dates back to Simon's commit
ff3e077bd23c("dm: pci: Add a uclass for PCI").I hope that Simon can tell us why he chose not to call
pci_init()ifDM_PCIis defined.
Driver model uses lazy init. We have discussed this before, and considered using a uclass flag to tell U-Boot that the uclass needs to be fully probed (i.e. probe all devices in that uclass, recursively).
But I'm not sure we got agreement. If you think it is a good idea you could send a patch. The only thing is that I think some platforms don't need PCI to boot so might not want this?
Regards,
Simon