[PATCH v3 2/3] efi: qemu: arm64: Add efi_rng_protocol implementation for the platform

Sughosh Ganu sughosh.ganu at linaro.org
Tue Dec 31 14:14:15 CET 2019


On Sat, 28 Dec 2019 at 21:09, Tuomas Tynkkynen <tuomas.tynkkynen at iki.fi>
wrote:

> Hi,
>
> On Sat, 28 Dec 2019 at 17:19, Heinrich Schuchardt <xypron.glpk at gmx.de>
> wrote:
> >
> > On 12/28/19 4:03 PM, Sughosh Ganu wrote:
> > >
> > > On Sat, 28 Dec 2019 at 20:01, Heinrich Schuchardt <xypron.glpk at gmx.de
> > > <mailto:xypron.glpk at gmx.de>> wrote:
> > >
> > >     On 12/27/19 3:26 PM, Sughosh Ganu wrote:
> > >      > Add support for the EFI_RNG_PROTOCOL routines for the qemu arm64
> > >      > platform. EFI_RNG_PROTOCOL is an uefi boottime service which is
> > >      > invoked by the efi stub in the kernel for getting random seed
> for
> > >      > kaslr.
> > >      >
> > >      > The routines are platform specific, and use the virtio-rng
> device on
> > >      > the platform to get random data.
> > >      >
> > >      > The feature can be enabled through the following config
> > >      > CONFIG_EFI_RNG_PROTOCOL
> > >      >
> > >      > Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org
> > >     <mailto:sughosh.ganu at linaro.org>>
> ...
> >
> > Adding the uclass_get_device() solution in a weak function is ok for me.
> >
> > When testing I already experienced that I had to issue the `virtio scan`
> > command.
> >
>
> But in board_init() in qemu-arm.c we already call virtio_init(). If that
> is not
> working correctly, there is a bug that should be fixed instead.
>

There is no issue with virtio_init.


>
> Maybe the problem is that PCI bus has not been scanned at the time of
> that virtio_init() call (so everything would work correctly with
> virtio-mmio
> but virtio-pci is broken)?
>

Yes, this is the issue. The pci bus has not been scanned when virtio_init
is called. In fact, the pci_init function gets called only as part of the
preboot function, before the main loop is invoked. Thus 'dm tree' shows the
virtio-pci device, but a virtio scan is needed to get the rng device.
Calling pci_init before virtio_init is called shows up all the virtio
devices.

-sughosh


More information about the U-Boot mailing list