diff options
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/kvm.c | 9 | ||||
-rw-r--r-- | target-ppc/kvm_ppc.h | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 9cf5308ac3..e641680fb1 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -2489,3 +2489,12 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) { return data & 0xffff; } + +int kvmppc_enable_hwrng(void) +{ + if (!kvm_enabled() || !kvm_check_extension(kvm_state, KVM_CAP_PPC_HWRNG)) { + return -1; + } + + return kvmppc_enable_hcall(kvm_state, H_RANDOM); +} diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h index f790d50e51..470f6d62f7 100644 --- a/target-ppc/kvm_ppc.h +++ b/target-ppc/kvm_ppc.h @@ -54,6 +54,7 @@ void kvmppc_hash64_free_pteg(uint64_t token); void kvmppc_hash64_write_pte(CPUPPCState *env, target_ulong pte_index, target_ulong pte0, target_ulong pte1); bool kvmppc_has_cap_fixup_hcalls(void); +int kvmppc_enable_hwrng(void); #else @@ -251,6 +252,10 @@ static inline bool kvmppc_has_cap_fixup_hcalls(void) abort(); } +static inline int kvmppc_enable_hwrng(void) +{ + return -1; +} #endif #ifndef CONFIG_KVM |