Message ID | 1537710145-1888-17-git-send-email-bmeng.cn@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Simon Glass |
Headers | show |
Series | virtio: Introduce VirtIO driver support | expand |
On 23 September 2018 at 06:42, Bin Meng <bmeng.cn@gmail.com> wrote: > 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> > --- > > board/emulation/qemu-arm/Kconfig | 3 +++ > board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ > 2 files changed, 10 insertions(+) > Reviewed-by: Simon Glass <sjg@chromium.org> But I wonder if we should have a flag in the uclass or perhaps device tree, to indicate that all devices in it should be probed at start-up? Could be useful for PCI too. > diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig > index d1c08c2..16b80fe 100644 > --- a/board/emulation/qemu-arm/Kconfig > +++ b/board/emulation/qemu-arm/Kconfig > @@ -5,5 +5,8 @@ config SYS_TEXT_BASE > > config BOARD_SPECIFIC_OPTIONS # dummy > def_bool y > + imply VIRTIO_MMIO > + 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..428498e 100644 > --- a/board/emulation/qemu-arm/qemu-arm.c > +++ b/board/emulation/qemu-arm/qemu-arm.c > @@ -4,6 +4,7 @@ > */ > #include <common.h> > #include <fdtdec.h> > +#include <virtio.h> > > #ifdef CONFIG_ARM64 > #include <asm/armv8/mmu.h> > @@ -58,6 +59,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; > } > > -- > 2.7.4 >
Hi Bin, On 09/23/2018 04:42 PM, Bin Meng wrote: > 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> > --- > > board/emulation/qemu-arm/Kconfig | 3 +++ > board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ > 2 files changed, 10 insertions(+) > ... >diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig >index d1c08c2..16b80fe 100644 >--- a/board/emulation/qemu-arm/Kconfig >+++ b/board/emulation/qemu-arm/Kconfig >@@ -5,5 +5,8 @@ config SYS_TEXT_BASE > > config BOARD_SPECIFIC_OPTIONS # dummy > def_bool y >+ imply VIRTIO_MMIO >+ imply VIRTIO_NET >+ imply VIRTIO_BLK I think we should have VIRTIO_PCI here as well, so that QEMU command lines that work on x86 will work on ARM just as well. ... > --- a/board/emulation/qemu-arm/qemu-arm.c > +++ b/board/emulation/qemu-arm/qemu-arm.c > @@ -4,6 +4,7 @@ > */ > #include <common.h> > #include <fdtdec.h> > +#include <virtio.h> > > #ifdef CONFIG_ARM64 > #include <asm/armv8/mmu.h> > @@ -58,6 +59,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; > } > > Note that in include/configs/qemu-arm.h, the boards auto-enumerate PCI devices with a different mechanism, like this: #define CONFIG_PREBOOT "pci enum" I am not sure which one is better but at least we should be consistent.
Hi Simon, On Thu, Sep 27, 2018 at 9:43 PM Simon Glass <sjg@chromium.org> wrote: > > On 23 September 2018 at 06:42, Bin Meng <bmeng.cn@gmail.com> wrote: > > 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> > > --- > > > > board/emulation/qemu-arm/Kconfig | 3 +++ > > board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ > > 2 files changed, 10 insertions(+) > > > > Reviewed-by: Simon Glass <sjg@chromium.org> > > But I wonder if we should have a flag in the uclass or perhaps device > tree, to indicate that all devices in it should be probed at start-up? > Could be useful for PCI too. > I think that's a good idea. I will leave this for now and when we have that capability we can revisit. [snip] Regards, Bin
Hi Tuomas, On Fri, Sep 28, 2018 at 6:13 AM Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote: > > Hi Bin, > > On 09/23/2018 04:42 PM, Bin Meng wrote: > > 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> > > --- > > > > board/emulation/qemu-arm/Kconfig | 3 +++ > > board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ > > 2 files changed, 10 insertions(+) > > > ... > >diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig > >index d1c08c2..16b80fe 100644 > >--- a/board/emulation/qemu-arm/Kconfig > >+++ b/board/emulation/qemu-arm/Kconfig > >@@ -5,5 +5,8 @@ config SYS_TEXT_BASE > > > > config BOARD_SPECIFIC_OPTIONS # dummy > > def_bool y > >+ imply VIRTIO_MMIO > >+ imply VIRTIO_NET > >+ imply VIRTIO_BLK > > I think we should have VIRTIO_PCI here as well, so that QEMU command lines > that work on x86 will work on ARM just as well. > Will do in v2. > ... > > --- a/board/emulation/qemu-arm/qemu-arm.c > > +++ b/board/emulation/qemu-arm/qemu-arm.c > > @@ -4,6 +4,7 @@ > > */ > > #include <common.h> > > #include <fdtdec.h> > > +#include <virtio.h> > > > > #ifdef CONFIG_ARM64 > > #include <asm/armv8/mmu.h> > > @@ -58,6 +59,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; > > } > > > > > > Note that in include/configs/qemu-arm.h, the boards auto-enumerate > PCI devices with a different mechanism, like this: > > #define CONFIG_PREBOOT "pci enum" > > I am not sure which one is better but at least we should be consistent. Ah yes, but I felt the same as you about which one is better :). I think using PREBOOT is a little bit late, for example if we call "virtio scan" here, we still see "Net: No ethernet found." which may confuse people. Probably what Simon suggested (have a flag to indicate that all devices in it should be probed at start-up) is an ideal solution ... Regards, Bin
diff --git a/board/emulation/qemu-arm/Kconfig b/board/emulation/qemu-arm/Kconfig index d1c08c2..16b80fe 100644 --- a/board/emulation/qemu-arm/Kconfig +++ b/board/emulation/qemu-arm/Kconfig @@ -5,5 +5,8 @@ config SYS_TEXT_BASE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y + imply VIRTIO_MMIO + 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..428498e 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -4,6 +4,7 @@ */ #include <common.h> #include <fdtdec.h> +#include <virtio.h> #ifdef CONFIG_ARM64 #include <asm/armv8/mmu.h> @@ -58,6 +59,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; }
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> --- board/emulation/qemu-arm/Kconfig | 3 +++ board/emulation/qemu-arm/qemu-arm.c | 7 +++++++ 2 files changed, 10 insertions(+)