u-boot/drivers/virtio
Andre Przywara 45c4b276f0 virtio: rng: gracefully handle 0 byte returns
According to the virtio v1.x "entropy device" specification, a virtio-rng
device is supposed to always return at least one byte of entropy.
However the virtio v0.9 spec does not mention such a requirement.

The Arm Fixed Virtual Platform (FVP) implementation of virtio-rng always
returns 8 bytes less of entropy than requested. If 8 bytes or less are
requested, it will return 0 bytes.
This behaviour makes U-Boot's virtio_rng_read() implementation go into an
endless loop, hanging the system.

Work around this problem by always requesting 8 bytes more than needed,
but only if a previous call to virtqueue_get_buf() returned 0 bytes.

This should never trigger on a v1.x spec compliant implementation, but
fixes the hang on the Arm FVP.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Peter Hoyes <peter.hoyes@arm.com>
2023-11-17 11:58:26 -05:00
..
Kconfig blk: Enable CONFIG_BLK for all media 2022-09-16 11:05:00 -04:00
Makefile virtio: pci: Allow exclusion of legacy driver 2022-05-03 15:50:45 -04:00
virtio_blk.c virtio: Add some debugging 2023-02-06 13:04:53 -05:00
virtio_blk.h virtio: Add block driver support 2018-11-14 09:16:27 -08:00
virtio_mmio.c dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
virtio_mmio.h common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
virtio_net.c dm: treewide: Rename dev_get_platdata() to dev_get_plat() 2020-12-13 16:51:09 -07:00
virtio_net.h virtio: Add net driver support 2018-11-14 09:16:27 -08:00
virtio_pci_legacy.c pci: Add mask parameter to dm_pci_map_bar() 2022-05-03 18:33:29 -04:00
virtio_pci_modern.c virtio: pci: Tear down VQs in virtio_pci_reset() 2023-04-25 11:53:15 -04:00
virtio_pci.h virtio: Add virtio over pci transport driver 2018-11-14 09:16:28 -08:00
virtio_ring.c virtio: Use bounce buffers when VIRTIO_F_IOMMU_PLATFORM is set 2023-04-25 11:53:15 -04:00
virtio_rng.c virtio: rng: gracefully handle 0 byte returns 2023-11-17 11:58:26 -05:00
virtio_sandbox.c virtio: Add a block device 2023-01-23 18:11:40 -05:00
virtio-uclass.c bootstd: Rename bootdev_setup_sibling_blk() 2023-08-09 23:31:11 +08:00