The H_RANDOM sPAPR hypercall is used to pass high-quality random numbers to guests (similar to virtio-rnd). Since the Linux guest kernels already support this hypercall, we should provide this interface in QEMU, too, in case virtio-rnd is not available in the guest yet.
First patch is an older patch by Michael Ellerman which sets up the device tree for this interface (which is already used when KVM in the host kernel supports the H_RANDOM hypercall). The second patch then implements the hypercall for plain QEMU, too, by using the RngBackends of QEMU. Note: Since I do not have access to the SPAPR spec, I figured out the calling conventions of the hypercall by looking at the way the Linux kernel is using this call to retriev random data. So there might be some bugs or missing pieces here... - if you spot something, please tell me! v2: - Added Michael's patch for setting up the device tree information - After discussing this hypercall with some people at KVM forum 2015, I've now reworked the code to use the RngBackend of QEMU instead of using /dev/random directly. Michael Ellerman (1): spapr: Add support for hwrng when available Thomas Huth (1): ppc/spapr_hcall: Implement H_RANDOM hypercall in QEMU hw/ppc/spapr.c | 50 +++++++++++++++++++++++++++++++-- hw/ppc/spapr_hcall.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 3 ++ target-ppc/kvm.c | 5 ++++ target-ppc/kvm_ppc.h | 5 ++++ 5 files changed, 135 insertions(+), 3 deletions(-) -- 1.8.3.1