[PATCH kernel v2] KVM: PPC: Use arch_get_random_seed_long instead of powernv variant

Fabiano Rosas farosas at linux.ibm.com
Sat Aug 7 00:53:06 AEST 2021


Alexey Kardashevskiy <aik at ozlabs.ru> writes:

> The powernv_get_random_long() does not work in nested KVM (which is
> pseries) and produces a crash when accessing in_be64(rng->regs) in
> powernv_get_random_long().
>
> This replaces powernv_get_random_long with the ppc_md machine hook
> wrapper.
>
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>

Reviewed-by: Fabiano Rosas <farosas at linux.ibm.com>

> ---
>
> Changes:
> v2:
> * replaces [PATCH kernel] powerpc/powernv: Check if powernv_rng is initialized
>
> ---
>  arch/powerpc/kvm/book3s_hv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index be0cde26f156..ecfd133e0ca8 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -1165,7 +1165,7 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>  		break;
>  #endif
>  	case H_RANDOM:
> -		if (!powernv_get_random_long(&vcpu->arch.regs.gpr[4]))
> +		if (!arch_get_random_seed_long(&vcpu->arch.regs.gpr[4]))
>  			ret = H_HARDWARE;
>  		break;
>  	case H_RPT_INVALIDATE:


More information about the Linuxppc-dev mailing list