Some PowerNV systems include a hardware random-number generator. This HWRNG is present on POWER7+ and POWER8 chips and is capable of generating one 64-bit random number every microsecond. The random numbers are produced by sampling a set of 64 unstable high-frequency oscillators and are almost completely entropic. PAPR defines an H_RANDOM hypercall which guests can use to obtain one 64-bit random sample from the HWRNG. This adds a real-mode implementation of the H_RANDOM hypercall. This hypercall was implemented in real mode because the latency of reading the HWRNG is generally small compared to the latency of a guest exit and entry for all the threads in the same virtual core. Userspace can detect the presence of the HWRNG and the H_RANDOM implementation by querying the KVM_CAP_PPC_HWRNG capability. The H_RANDOM hypercall implementation will only be invoked when the guest does an H_RANDOM hypercall if userspace first enables the in-kernel H_RANDOM implementation using the KVM_CAP_PPC_ENABLE_HCALL capability.
Showing the changes to include/uapi/linux (1 of 8 files). Show all
Unified · Split
| @@ -813,6 +813,7 @@ struct kvm_ppc_smmu_info { · 812 unmodified lines | |||
| 813 | #define KVM_CAP_MIPS_MSA 112 | 813 | #define KVM_CAP_MIPS_MSA 112 |
| 814 | #define KVM_CAP_S390_INJECT_IRQ 113 | 814 | #define KVM_CAP_S390_INJECT_IRQ 113 |
| 815 | #define KVM_CAP_S390_IRQ_STATE 114 | 815 | #define KVM_CAP_S390_IRQ_STATE 114 |
| 816 | #define KVM_CAP_PPC_HWRNG 115 | ||
| 816 | 817 | ||
| 817 | #ifdef KVM_CAP_IRQ_ROUTING | 818 | #ifdef KVM_CAP_IRQ_ROUTING |
| 818 | 819 | ||