Hello, Here's the 2nd iteration of the virtio hwrng device.
This device just accepts data from the chardev and sends it up to the guest. There's no policy here on restricting the number of bytes we send to the guest, as that can be done by management apps. libvirt has a better picture of the host's entropy and multiple guests, so it can better make decisions on when to supply entropy, and how much. Of course, Linux has a low watermark, via /proc/sys/kernel/random/entropy_avail and it will stop giving out entropy once that watermark is reached (currently 64). /dev/urandom doesn't use all the bits at once, so using that device to feed in entropy to the guest is safer and faster (without compromising on the quality of randomness). libvirt can also use daemons like egd to feed in entropy. v2: * Remove hard-wiring to /dev/urandom * Use chardev for input * Add a QMP event for notifying listeners about entropy needed and the bytes asked for by the guest. * Add s390 code Please review, and apply if appropriate. Amit Shah (1): virtio-rng: hardware random number generator device Makefile.objs | 1 + hw/pci.h | 1 + hw/s390-virtio-bus.c | 35 +++++++++ hw/s390-virtio-bus.h | 2 + hw/virtio-pci.c | 51 +++++++++++++ hw/virtio-pci.h | 2 + hw/virtio-rng.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/virtio-rng.h | 24 ++++++ hw/virtio.h | 3 + monitor.c | 3 + monitor.h | 1 + 11 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 hw/virtio-rng.c create mode 100644 hw/virtio-rng.h -- 1.7.7.6