From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sughosh Ganu Date: Tue, 31 Dec 2019 18:44:15 +0530 Subject: [PATCH v3 2/3] efi: qemu: arm64: Add efi_rng_protocol implementation for the platform In-Reply-To: References: <1577456776-22960-1-git-send-email-sughosh.ganu@linaro.org> <1577456776-22960-3-git-send-email-sughosh.ganu@linaro.org> <10865b4b-a8ce-e276-316c-ced4c56d6b4a@gmx.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, 28 Dec 2019 at 21:09, Tuomas Tynkkynen wrote: > Hi, > > On Sat, 28 Dec 2019 at 17:19, Heinrich Schuchardt > wrote: > > > > On 12/28/19 4:03 PM, Sughosh Ganu wrote: > > > > > > On Sat, 28 Dec 2019 at 20:01, Heinrich Schuchardt > > > 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 > > > > ... > > > > 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